Bug 469739 - Add support for displaying Vista UAC shield icon; r=joe sr=vladimir
[wine-gecko.git] / nsprpub / pr / include / prmon.h
blobd2a1971cfee59dbfd917ae529458e4fa17e9be3e
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) 1998-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 ***** */
38 #ifndef prmon_h___
39 #define prmon_h___
41 #include "prtypes.h"
42 #include "prinrval.h"
44 PR_BEGIN_EXTERN_C
46 typedef struct PRMonitor PRMonitor;
49 ** Create a new monitor. Monitors are re-entrant locks with a single built-in
50 ** condition variable.
52 ** This may fail if memory is tight or if some operating system resource
53 ** is low.
55 NSPR_API(PRMonitor*) PR_NewMonitor(void);
58 ** Destroy a monitor. The caller is responsible for guaranteeing that the
59 ** monitor is no longer in use. There must be no thread waiting on the monitor's
60 ** condition variable and that the lock is not held.
63 NSPR_API(void) PR_DestroyMonitor(PRMonitor *mon);
66 ** Enter the lock associated with the monitor. If the calling thread currently
67 ** is in the monitor, the call to enter will silently succeed. In either case,
68 ** it will increment the entry count by one.
70 NSPR_API(void) PR_EnterMonitor(PRMonitor *mon);
73 ** Decrement the entry count associated with the monitor. If the decremented
74 ** entry count is zero, the monitor is exited. Returns PR_FAILURE if the
75 ** calling thread has not entered the monitor.
77 NSPR_API(PRStatus) PR_ExitMonitor(PRMonitor *mon);
80 ** Wait for a notify on the monitor's condition variable. Sleep for "ticks"
81 ** amount of time (if "ticks" is PR_INTERVAL_NO_TIMEOUT then the sleep is
82 ** indefinite).
84 ** While the thread is waiting it exits the monitor (as if it called
85 ** PR_ExitMonitor as many times as it had called PR_EnterMonitor). When
86 ** the wait has finished the thread regains control of the monitors lock
87 ** with the same entry count as before the wait began.
89 ** The thread waiting on the monitor will be resumed when the monitor is
90 ** notified (assuming the thread is the next in line to receive the
91 ** notify) or when the "ticks" timeout elapses.
93 ** Returns PR_FAILURE if the caller has not entered the monitor.
95 NSPR_API(PRStatus) PR_Wait(PRMonitor *mon, PRIntervalTime ticks);
98 ** Notify a thread waiting on the monitor's condition variable. If a thread
99 ** is waiting on the condition variable (using PR_Wait) then it is awakened
100 ** and attempts to reenter the monitor.
102 NSPR_API(PRStatus) PR_Notify(PRMonitor *mon);
105 ** Notify all of the threads waiting on the monitor's condition variable.
106 ** All of threads waiting on the condition are scheduled to reenter the
107 ** monitor.
109 NSPR_API(PRStatus) PR_NotifyAll(PRMonitor *mon);
111 PR_END_EXTERN_C
113 #endif /* prmon_h___ */