VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/nsprpub/pr/include/prinit.h@ 101948

Last change on this file since 101948 was 101947, checked in by vboxsync, 15 months ago

libs/xpcom: Get rid of now unused code in nsprpub, bugref:10545

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is the Netscape Portable Runtime (NSPR).
16 *
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998-2000
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38#ifndef prinit_h___
39#define prinit_h___
40
41#include "prthread.h"
42#include "prtypes.h"
43#include <stdio.h>
44
45#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
46#define PR_Abort VBoxNsprPR_Abort
47#define PR_Cleanup VBoxNsprPR_Cleanup
48#define PR_Init VBoxNsprPR_Init
49#define PR_Initialize VBoxNsprPR_Initialize
50#define PR_Initialized VBoxNsprPR_Initialized
51#define PR_SetFDCacheSize VBoxNsprPR_SetFDCacheSize
52#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
53
54PR_BEGIN_EXTERN_C
55
56/************************************************************************/
57/**************************IDENTITY AND VERSIONING***********************/
58/************************************************************************/
59
60/*
61** NSPR's name, this should persist until at least the turn of the
62** century.
63*/
64#define PR_NAME "NSPR"
65
66/*
67** NSPR's version is used to determine the likelihood that the version you
68** used to build your component is anywhere close to being compatible with
69** what is in the underlying library.
70**
71** The format of the version string is
72** "<major version>.<minor version>[.<patch level>] [<Beta>]"
73*/
74#define PR_VERSION "4.6 Beta"
75#define PR_VMAJOR 4
76#define PR_VMINOR 6
77#define PR_VPATCH 0
78#define PR_BETA PR_TRUE
79
80/************************************************************************/
81/*******************************INITIALIZATION***************************/
82/************************************************************************/
83
84/*
85** Initialize the runtime. Attach a thread object to the currently
86** executing native thread of type "type".
87**
88** The specificaiton of 'maxPTDs' is ignored.
89*/
90NSPR_API(void) PR_Init(
91 PRThreadType type, PRThreadPriority priority, PRUintn maxPTDs);
92
93/*
94** And alternate form of initialization, one that may become the default if
95** not the only mechanism, provides a method to get the NSPR runtime init-
96** ialized and place NSPR between the caller and the runtime library. This
97** allows main() to be treated as any other thread root function, signalling
98** its compeletion by returning and allowing the runtime to coordinate the
99** completion of the other threads of the runtime.
100**
101** The priority of the main (or primordial) thread will be PR_PRIORITY_NORMAL.
102** The thread may adjust its own priority by using PR_SetPriority(), though
103** at this time the support for priorities is somewhat weak.
104**
105** The specificaiton of 'maxPTDs' is ignored.
106**
107** The value returned by PR_Initialize is the value returned from the root
108** function, 'prmain'.
109*/
110
111typedef PRIntn (PR_CALLBACK *PRPrimordialFn)(PRIntn argc, char **argv);
112
113NSPR_API(PRIntn) PR_Initialize(
114 PRPrimordialFn prmain, PRIntn argc, char **argv, PRUintn maxPTDs);
115
116/*
117** Return PR_TRUE if PR_Init has already been called.
118*/
119NSPR_API(PRBool) PR_Initialized(void);
120
121/*
122 * Perform a graceful shutdown of NSPR. PR_Cleanup() may be called by
123 * the primordial thread near the end of the main() function.
124 *
125 * PR_Cleanup() attempts to synchronize the natural termination of
126 * process. It does that by blocking the caller, if and only if it is
127 * the primordial thread, until the number of user threads has dropped
128 * to zero. When the primordial thread returns from main(), the process
129 * will immediately and silently exit. That is, it will (if necessary)
130 * forcibly terminate any existing threads and exit without significant
131 * blocking and there will be no error messages or core files.
132 *
133 * PR_Cleanup() returns PR_SUCCESS if NSPR is successfully shutdown,
134 * or PR_FAILURE if the calling thread of this function is not the
135 * primordial thread.
136 */
137NSPR_API(PRStatus) PR_Cleanup(void);
138
139/*
140** Control the method and size of the file descriptor (PRFileDesc*)
141** cache used by the runtime. Setting 'high' to zero is for performance,
142** any other value probably for debugging (see memo on FD caching).
143*/
144NSPR_API(PRStatus) PR_SetFDCacheSize(PRIntn low, PRIntn high);
145
146/*
147** Abort the process in a non-graceful manner. This will cause a core file,
148** call to the debugger or other moral equivalent as well as causing the
149** entire process to stop.
150*/
151NSPR_API(void) PR_Abort(void);
152
153PR_END_EXTERN_C
154
155#endif /* prinit_h___ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette