VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/nsprpub/pr/include/prtpool.h@ 26515

Last change on this file since 26515 was 11551, checked in by vboxsync, 16 years ago

API/xpcom: prefix any C symbols in VBoxXPCOM.so, to avoid namespace pollution. Enabled only on Linux at the moment.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 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) 1999-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 prtpool_h___
39#define prtpool_h___
40
41#include "prtypes.h"
42#include "prthread.h"
43#include "prio.h"
44#include "prerror.h"
45
46/*
47 * NOTE:
48 * THIS API IS A PRELIMINARY VERSION IN NSPR 4.0 AND IS SUBJECT TO
49 * CHANGE
50 */
51
52#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
53#define PR_CreateThreadPool VBoxNsprPR_CreateThreadPool
54#define PR_QueueJobPR_QueueJob_Read VBoxNsprPR_QueueJobPR_QueueJob_Read
55#define PR_QueueJob VBoxNsprPR_QueueJob
56#define PR_QueueJob_Read VBoxNsprPR_QueueJob_Read
57#define PR_QueueJob_Write VBoxNsprPR_QueueJob_Write
58#define PR_QueueJob_Accept VBoxNsprPR_QueueJob_Accept
59#define PR_QueueJob_Connect VBoxNsprPR_QueueJob_Connect
60#define PR_QueueJob_Timer VBoxNsprPR_QueueJob_Timer
61#define PR_CancelJob VBoxNsprPR_CancelJob
62#define PR_JoinJob VBoxNsprPR_JoinJob
63#define PR_ShutdownThreadPool VBoxNsprPR_ShutdownThreadPool
64#define PR_JoinThreadPool VBoxNsprPR_JoinThreadPool
65#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
66
67PR_BEGIN_EXTERN_C
68
69typedef struct PRJobIoDesc {
70 PRFileDesc *socket;
71 PRErrorCode error;
72 PRIntervalTime timeout;
73} PRJobIoDesc;
74
75typedef struct PRThreadPool PRThreadPool;
76typedef struct PRJob PRJob;
77typedef void (PR_CALLBACK *PRJobFn) (void *arg);
78
79/* Create thread pool */
80NSPR_API(PRThreadPool *)
81PR_CreateThreadPool(PRInt32 initial_threads, PRInt32 max_threads,
82 PRUint32 stacksize);
83
84/* queue a job */
85NSPR_API(PRJob *)
86PR_QueueJob(PRThreadPool *tpool, PRJobFn fn, void *arg, PRBool joinable);
87
88/* queue a job, when a socket is readable */
89NSPR_API(PRJob *)
90PR_QueueJob_Read(PRThreadPool *tpool, PRJobIoDesc *iod,
91 PRJobFn fn, void * arg, PRBool joinable);
92
93/* queue a job, when a socket is writeable */
94NSPR_API(PRJob *)
95PR_QueueJob_Write(PRThreadPool *tpool, PRJobIoDesc *iod,
96 PRJobFn fn, void * arg, PRBool joinable);
97
98/* queue a job, when a socket has a pending connection */
99NSPR_API(PRJob *)
100PR_QueueJob_Accept(PRThreadPool *tpool, PRJobIoDesc *iod,
101 PRJobFn fn, void * arg, PRBool joinable);
102
103/* queue a job, when the socket connection to addr succeeds or fails */
104NSPR_API(PRJob *)
105PR_QueueJob_Connect(PRThreadPool *tpool, PRJobIoDesc *iod,
106 const PRNetAddr *addr, PRJobFn fn, void * arg, PRBool joinable);
107
108/* queue a job, when a timer exipres */
109NSPR_API(PRJob *)
110PR_QueueJob_Timer(PRThreadPool *tpool, PRIntervalTime timeout,
111 PRJobFn fn, void * arg, PRBool joinable);
112/* cancel a job */
113NSPR_API(PRStatus)
114PR_CancelJob(PRJob *job);
115
116/* join a job */
117NSPR_API(PRStatus)
118PR_JoinJob(PRJob *job);
119
120/* shutdown pool */
121NSPR_API(PRStatus)
122PR_ShutdownThreadPool(PRThreadPool *tpool);
123
124/* join pool, wait for exit of all threads */
125NSPR_API(PRStatus)
126PR_JoinThreadPool(PRThreadPool *tpool);
127
128PR_END_EXTERN_C
129
130#endif /* prtpool_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