nsprpub/pr/include/prtpool.h

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

     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 prtpool_h___
     7 #define prtpool_h___
     9 #include "prtypes.h"
    10 #include "prthread.h"
    11 #include "prio.h"
    12 #include "prerror.h"
    14 /*
    15  * NOTE:
    16  *		THIS API IS A PRELIMINARY VERSION IN NSPR 4.0 AND IS SUBJECT TO
    17  *		CHANGE
    18  */
    20 PR_BEGIN_EXTERN_C
    22 typedef struct PRJobIoDesc {
    23     PRFileDesc *socket;
    24     PRErrorCode error;
    25     PRIntervalTime timeout;
    26 } PRJobIoDesc;
    28 typedef struct PRThreadPool PRThreadPool;
    29 typedef struct PRJob PRJob;
    30 typedef void (PR_CALLBACK *PRJobFn) (void *arg);
    32 /* Create thread pool */
    33 NSPR_API(PRThreadPool *)
    34 PR_CreateThreadPool(PRInt32 initial_threads, PRInt32 max_threads,
    35                           PRUint32 stacksize);
    37 /* queue a job */
    38 NSPR_API(PRJob *)
    39 PR_QueueJob(PRThreadPool *tpool, PRJobFn fn, void *arg, PRBool joinable);
    41 /* queue a job, when a socket is readable */
    42 NSPR_API(PRJob *)
    43 PR_QueueJob_Read(PRThreadPool *tpool, PRJobIoDesc *iod,
    44 							PRJobFn fn, void * arg, PRBool joinable);
    46 /* queue a job, when a socket is writeable */
    47 NSPR_API(PRJob *)
    48 PR_QueueJob_Write(PRThreadPool *tpool, PRJobIoDesc *iod,
    49 								PRJobFn fn, void * arg, PRBool joinable);
    51 /* queue a job, when a socket has a pending connection */
    52 NSPR_API(PRJob *)
    53 PR_QueueJob_Accept(PRThreadPool *tpool, PRJobIoDesc *iod,
    54 									PRJobFn fn, void * arg, PRBool joinable);
    56 /* queue a job, when the socket connection to addr succeeds or fails */
    57 NSPR_API(PRJob *)
    58 PR_QueueJob_Connect(PRThreadPool *tpool, PRJobIoDesc *iod,
    59 			const PRNetAddr *addr, PRJobFn fn, void * arg, PRBool joinable);
    61 /* queue a job, when a timer exipres */
    62 NSPR_API(PRJob *)
    63 PR_QueueJob_Timer(PRThreadPool *tpool, PRIntervalTime timeout,
    64 								PRJobFn fn, void * arg, PRBool joinable);
    65 /* cancel a job */
    66 NSPR_API(PRStatus)
    67 PR_CancelJob(PRJob *job);
    69 /* join a job */
    70 NSPR_API(PRStatus)
    71 PR_JoinJob(PRJob *job);
    73 /* shutdown pool */
    74 NSPR_API(PRStatus)
    75 PR_ShutdownThreadPool(PRThreadPool *tpool);
    77 /* join pool, wait for exit of all threads */
    78 NSPR_API(PRStatus)
    79 PR_JoinThreadPool(PRThreadPool *tpool);
    81 PR_END_EXTERN_C
    83 #endif /* prtpool_h___ */

mercurial