Bug 449533. Set the mFixedPitch flag within SetFixedPitch. r+sr=vlad
[wine-gecko.git] / nsprpub / pr / include / pripcsem.h
blob5a96be5813a3a471f49cf4e34426909f2e3395cc
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
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/
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.
15 * The Original Code is the Netscape Portable Runtime (NSPR).
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.
22 * Contributor(s):
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.
36 * ***** END LICENSE BLOCK ***** */
39 * File: pripcsem.h
41 * Description: named semaphores for interprocess
42 * synchronization
44 * Unrelated processes obtain access to a shared semaphore
45 * by specifying its name.
47 * Our goal is to support named semaphores on at least
48 * Unix and Win32 platforms. The implementation will use
49 * one of the three native semaphore APIs: POSIX, System V,
50 * and Win32.
52 * Because POSIX named semaphores have kernel persistence,
53 * we are forced to have a delete function in this API.
56 #ifndef pripcsem_h___
57 #define pripcsem_h___
59 #include "prtypes.h"
60 #include "prio.h"
62 PR_BEGIN_EXTERN_C
65 * PRSem is an opaque structure that represents a named
66 * semaphore.
68 typedef struct PRSem PRSem;
71 * PR_OpenSemaphore --
73 * Create or open a named semaphore with the specified name.
74 * A handle to the semaphore is returned.
76 * If the named semaphore doesn't exist and the PR_SEM_CREATE
77 * flag is specified, the named semaphore is created. The
78 * created semaphore needs to be removed from the system with
79 * a PR_DeleteSemaphore call.
81 * If PR_SEM_CREATE is specified, the third argument is the
82 * access permission bits of the new semaphore (same
83 * interpretation as the mode argument to PR_Open) and the
84 * fourth argument is the initial value of the new semaphore.
85 * If PR_SEM_CREATE is not specified, the third and fourth
86 * arguments are ignored.
89 #define PR_SEM_CREATE 0x1 /* create if not exist */
90 #define PR_SEM_EXCL 0x2 /* fail if already exists */
92 NSPR_API(PRSem *) PR_OpenSemaphore(
93 const char *name, PRIntn flags, PRIntn mode, PRUintn value);
96 * PR_WaitSemaphore --
98 * If the value of the semaphore is > 0, decrement the value and return.
99 * If the value is 0, sleep until the value becomes > 0, then decrement
100 * the value and return.
102 * The "test and decrement" operation is performed atomically.
105 NSPR_API(PRStatus) PR_WaitSemaphore(PRSem *sem);
108 * PR_PostSemaphore --
110 * Increment the value of the named semaphore by 1.
113 NSPR_API(PRStatus) PR_PostSemaphore(PRSem *sem);
116 * PR_CloseSemaphore --
118 * Close a named semaphore handle.
121 NSPR_API(PRStatus) PR_CloseSemaphore(PRSem *sem);
124 * PR_DeleteSemaphore --
126 * Remove a named semaphore from the system.
129 NSPR_API(PRStatus) PR_DeleteSemaphore(const char *name);
131 PR_END_EXTERN_C
133 #endif /* pripcsem_h___ */