pr_cleanup.rst (945B)
1 PR_Cleanup 2 ========== 3 4 Coordinates a graceful shutdown of NSPR. 5 6 7 Syntax 8 ------ 9 10 .. code:: 11 12 #include <prinit.h> 13 14 PRStatus PR_Cleanup(void); 15 16 17 Returns 18 ~~~~~~~ 19 20 The function returns one of the following values: 21 22 - If NSPR has been shut down successfully, ``PR_SUCCESS``. 23 - If the calling thread of this function is not the primordial thread, 24 ``PR_FAILURE``. 25 26 27 Description 28 ----------- 29 30 :ref:`PR_Cleanup` must be called by the primordial thread near the end of 31 the ``main`` function. 32 33 :ref:`PR_Cleanup` attempts to synchronize the natural termination of the 34 process. It does so by blocking the caller, if and only if it is the 35 primordial thread, until all user threads have terminated. When the 36 primordial thread returns from ``main``, the process immediately and 37 silently exits. That is, the process (if necessary) forcibly terminates 38 any existing threads and exits without significant blocking and without 39 error messages or core files.