comparison nspr/pr/include/obsolete/prsem.h @ 0:1e5118fa0cb1

This is NSS with a Cmake Buildsyste To compile a static NSS library for Windows we've used the Chromium-NSS fork and added a Cmake buildsystem to compile it statically for Windows. See README.chromium for chromium changes and README.trustbridge for our modifications.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 28 Jul 2014 10:47:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1e5118fa0cb1
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/. */
5
6 #ifndef prsem_h___
7 #define prsem_h___
8
9 /*
10 ** API for counting semaphores. Semaphores are counting synchronizing
11 ** variables based on a lock and a condition variable. They are lightweight
12 ** contention control for a given count of resources.
13 */
14 #include "prtypes.h"
15
16 PR_BEGIN_EXTERN_C
17
18 typedef struct PRSemaphore PRSemaphore;
19
20 /*
21 ** Create a new semaphore object.
22 */
23 NSPR_API(PRSemaphore*) PR_NewSem(PRUintn value);
24
25 /*
26 ** Destroy the given semaphore object.
27 **
28 */
29 NSPR_API(void) PR_DestroySem(PRSemaphore *sem);
30
31 /*
32 ** Wait on a Semaphore.
33 **
34 ** This routine allows a calling thread to wait or proceed depending upon the
35 ** state of the semahore sem. The thread can proceed only if the counter value
36 ** of the semaphore sem is currently greater than 0. If the value of semaphore
37 ** sem is positive, it is decremented by one and the routine returns immediately
38 ** allowing the calling thread to continue. If the value of semaphore sem is 0,
39 ** the calling thread blocks awaiting the semaphore to be released by another
40 ** thread.
41 **
42 ** This routine can return PR_PENDING_INTERRUPT if the waiting thread
43 ** has been interrupted.
44 */
45 NSPR_API(PRStatus) PR_WaitSem(PRSemaphore *sem);
46
47 /*
48 ** This routine increments the counter value of the semaphore. If other threads
49 ** are blocked for the semaphore, then the scheduler will determine which ONE
50 ** thread will be unblocked.
51 */
52 NSPR_API(void) PR_PostSem(PRSemaphore *sem);
53
54 /*
55 ** Returns the value of the semaphore referenced by sem without affecting
56 ** the state of the semaphore. The value represents the semaphore vaule
57 F** at the time of the call, but may not be the actual value when the
58 ** caller inspects it.
59 */
60 NSPR_API(PRUintn) PR_GetValueSem(PRSemaphore *sem);
61
62 PR_END_EXTERN_C
63
64 #endif /* prsem_h___ */
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)