1PR_Initialize
2=============
3
4Provides an alternate form of explicit initialization. In addition to
5establishing the sequence of operations, :ref:`PR_Initialize` implicitly
6calls :ref:`PR_Cleanup` on exiting the primordial function.
7
8
9Syntax
10------
11
12.. code:: eval
13
14   #include <prinit.h>
15
16   PRIntn PR_Initialize(
17     PRPrimordialFn prmain,
18     PRIntn argc,
19     char **argv,
20     PRUintn maxPTDs);
21
22
23Parameters
24~~~~~~~~~~
25
26:ref:`PR_Initialize` has the following parameters:
27
28``prmain``
29   The function that becomes the primordial thread's root function.
30   Returning from prmain leads to termination of the process.
31``argc``
32   The length of the argument vector, whether passed in from the host's
33   program-launching facility or fabricated by the actual main program.
34   This approach conforms to standard C programming practice.
35``argv``
36   The base address of an array of strings that compromise the program's
37   argument vector. This approach conforms to standard C programming
38   practice.
39``maxPTDs``
40   This parameter is ignored.
41
42
43Returns
44~~~~~~~
45
46The value returned from the root function, ``prmain``.
47
48
49Description
50-----------
51
52:ref:`PR_Initialize` initializes the NSPR runtime and places NSPR between
53the caller and the runtime library. This allows ``main`` to be treated
54like any other function, signaling its completion by returning and
55allowing the runtime to coordinate the completion of the other threads
56of the runtime.
57
58:ref:`PR_Initialize` does not return to its caller until all user threads
59have terminated.
60
61The priority of the main (or primordial) thread is
62``PR_PRIORITY_NORMAL``. The thread may adjust its own priority by using
63:ref:`PR_SetThreadPriority`.
64