Fix Centurion name.
[0ad.git] / libraries / source / spidermonkey / include-win32-release / nspr / prinit.h
blob331119f2ef7f6a5130f9e6e5648f9bd907513afe
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef prinit_h___
7 #define prinit_h___
9 #include "prthread.h"
10 #include "prtypes.h"
11 #include "prwin16.h"
12 #include <stdio.h>
14 PR_BEGIN_EXTERN_C
16 /************************************************************************/
17 /**************************IDENTITY AND VERSIONING***********************/
18 /************************************************************************/
21 ** NSPR's name, this should persist until at least the turn of the
22 ** century.
24 #define PR_NAME "NSPR"
27 ** NSPR's version is used to determine the likelihood that the version you
28 ** used to build your component is anywhere close to being compatible with
29 ** what is in the underlying library.
31 ** The format of the version string is
32 ** "<major version>.<minor version>[.<patch level>] [<Beta>]"
34 #define PR_VERSION "4.25.1"
35 #define PR_VMAJOR 4
36 #define PR_VMINOR 25
37 #define PR_VPATCH 1
38 #define PR_BETA PR_FALSE
41 ** PRVersionCheck
43 ** The basic signature of the function that is called to provide version
44 ** checking. The result will be a boolean that indicates the likelihood
45 ** that the underling library will perform as the caller expects.
47 ** The only argument is a string, which should be the verson identifier
48 ** of the library in question. That string will be compared against an
49 ** equivalent string that represents the actual build version of the
50 ** exporting library.
52 ** The result will be the logical union of the directly called library
53 ** and all dependent libraries.
56 typedef PRBool (*PRVersionCheck)(const char*);
59 ** PR_VersionCheck
61 ** NSPR's existance proof of the version check function.
63 ** Note that NSPR has no cooperating dependencies.
66 NSPR_API(PRBool) PR_VersionCheck(const char *importedVersion);
69 * Returns a const string of the NSPR library version.
71 NSPR_API(const char*) PR_GetVersion(void);
74 /************************************************************************/
75 /*******************************INITIALIZATION***************************/
76 /************************************************************************/
79 ** Initialize the runtime. Attach a thread object to the currently
80 ** executing native thread of type "type".
82 ** The specificaiton of 'maxPTDs' is ignored.
84 NSPR_API(void) PR_Init(
85 PRThreadType type, PRThreadPriority priority, PRUintn maxPTDs);
88 ** And alternate form of initialization, one that may become the default if
89 ** not the only mechanism, provides a method to get the NSPR runtime init-
90 ** ialized and place NSPR between the caller and the runtime library. This
91 ** allows main() to be treated as any other thread root function, signalling
92 ** its compeletion by returning and allowing the runtime to coordinate the
93 ** completion of the other threads of the runtime.
95 ** The priority of the main (or primordial) thread will be PR_PRIORITY_NORMAL.
96 ** The thread may adjust its own priority by using PR_SetPriority(), though
97 ** at this time the support for priorities is somewhat weak.
99 ** The specificaiton of 'maxPTDs' is ignored.
101 ** The value returned by PR_Initialize is the value returned from the root
102 ** function, 'prmain'.
105 typedef PRIntn (PR_CALLBACK *PRPrimordialFn)(PRIntn argc, char **argv);
107 NSPR_API(PRIntn) PR_Initialize(
108 PRPrimordialFn prmain, PRIntn argc, char **argv, PRUintn maxPTDs);
111 ** Return PR_TRUE if PR_Init has already been called.
113 NSPR_API(PRBool) PR_Initialized(void);
116 * Perform a graceful shutdown of NSPR. PR_Cleanup() may be called by
117 * the primordial thread near the end of the main() function.
119 * PR_Cleanup() attempts to synchronize the natural termination of
120 * process. It does that by blocking the caller, if and only if it is
121 * the primordial thread, until the number of user threads has dropped
122 * to zero. When the primordial thread returns from main(), the process
123 * will immediately and silently exit. That is, it will (if necessary)
124 * forcibly terminate any existing threads and exit without significant
125 * blocking and there will be no error messages or core files.
127 * PR_Cleanup() returns PR_SUCCESS if NSPR is successfully shutdown,
128 * or PR_FAILURE if the calling thread of this function is not the
129 * primordial thread.
131 NSPR_API(PRStatus) PR_Cleanup(void);
134 ** Disable Interrupts
135 ** Disables timer signals used for pre-emptive scheduling.
137 NSPR_API(void) PR_DisableClockInterrupts(void);
140 ** Enables Interrupts
141 ** Enables timer signals used for pre-emptive scheduling.
143 NSPR_API(void) PR_EnableClockInterrupts(void);
146 ** Block Interrupts
147 ** Blocks the timer signal used for pre-emptive scheduling
149 NSPR_API(void) PR_BlockClockInterrupts(void);
152 ** Unblock Interrupts
153 ** Unblocks the timer signal used for pre-emptive scheduling
155 NSPR_API(void) PR_UnblockClockInterrupts(void);
158 ** Create extra virtual processor threads. Generally used with MP systems.
160 NSPR_API(void) PR_SetConcurrency(PRUintn numCPUs);
163 ** Control the method and size of the file descriptor (PRFileDesc*)
164 ** cache used by the runtime. Setting 'high' to zero is for performance,
165 ** any other value probably for debugging (see memo on FD caching).
167 NSPR_API(PRStatus) PR_SetFDCacheSize(PRIntn low, PRIntn high);
170 * Cause an immediate, nongraceful, forced termination of the process.
171 * It takes a PRIntn argument, which is the exit status code of the
172 * process.
174 NSPR_API(void) PR_ProcessExit(PRIntn status);
177 ** Abort the process in a non-graceful manner. This will cause a core file,
178 ** call to the debugger or other moral equivalent as well as causing the
179 ** entire process to stop.
181 NSPR_API(void) PR_Abort(void);
184 ****************************************************************
186 * Module initialization:
188 ****************************************************************
191 typedef struct PRCallOnceType {
192 PRIntn initialized;
193 PRInt32 inProgress;
194 PRStatus status;
195 } PRCallOnceType;
197 typedef PRStatus (PR_CALLBACK *PRCallOnceFN)(void);
199 typedef PRStatus (PR_CALLBACK *PRCallOnceWithArgFN)(void *arg);
201 NSPR_API(PRStatus) PR_CallOnce(
202 PRCallOnceType *once,
203 PRCallOnceFN func
206 NSPR_API(PRStatus) PR_CallOnceWithArg(
207 PRCallOnceType *once,
208 PRCallOnceWithArgFN func,
209 void *arg
213 PR_END_EXTERN_C
215 #endif /* prinit_h___ */