Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: gecko-sdk/include/prcvar.h

Issue 20346: Version 1.8 of gecko-sdk. Downloaded from here:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gecko-sdk/include/prcpucfg.h ('k') | gecko-sdk/include/prdtoa.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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) 1998-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 prcvar_h___
39 #define prcvar_h___
40
41 #include "prlock.h"
42 #include "prinrval.h"
43
44 PR_BEGIN_EXTERN_C
45
46 typedef struct PRCondVar PRCondVar;
47
48 /*
49 ** Create a new condition variable.
50 **
51 ** "lock" is the lock used to protect the condition variable.
52 **
53 ** Condition variables are synchronization objects that threads can use
54 ** to wait for some condition to occur.
55 **
56 ** This may fail if memory is tight or if some operating system resource
57 ** is low. In such cases, a NULL will be returned.
58 */
59 NSPR_API(PRCondVar*) PR_NewCondVar(PRLock *lock);
60
61 /*
62 ** Destroy a condition variable. There must be no thread
63 ** waiting on the condvar. The caller is responsible for guaranteeing
64 ** that the condvar is no longer in use.
65 **
66 */
67 NSPR_API(void) PR_DestroyCondVar(PRCondVar *cvar);
68
69 /*
70 ** The thread that waits on a condition is blocked in a "waiting on
71 ** condition" state until another thread notifies the condition or a
72 ** caller specified amount of time expires. The lock associated with
73 ** the condition variable will be released, which must have be held
74 ** prior to the call to wait.
75 **
76 ** Logically a notified thread is moved from the "waiting on condition"
77 ** state and made "ready." When scheduled, it will attempt to reacquire
78 ** the lock that it held when wait was called.
79 **
80 ** The timeout has two well known values, PR_INTERVAL_NO_TIMEOUT and
81 ** PR_INTERVAL_NO_WAIT. The former value requires that a condition be
82 ** notified (or the thread interrupted) before it will resume from the
83 ** wait. If the timeout has a value of PR_INTERVAL_NO_WAIT, the effect
84 ** is to release the lock, possibly causing a rescheduling within the
85 ** runtime, then immediately attempting to reacquire the lock and resume.
86 **
87 ** Any other value for timeout will cause the thread to be rescheduled
88 ** either due to explicit notification or an expired interval. The latter
89 ** must be determined by treating time as one part of the monitored data
90 ** being protected by the lock and tested explicitly for an expired
91 ** interval.
92 **
93 ** Returns PR_FAILURE if the caller has not locked the lock associated
94 ** with the condition variable or the thread was interrupted (PR_Interrupt()).
95 ** The particular reason can be extracted with PR_GetError().
96 */
97 NSPR_API(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout);
98
99 /*
100 ** Notify ONE thread that is currently waiting on 'cvar'. Which thread is
101 ** dependent on the implementation of the runtime. Common sense would dictate
102 ** that all threads waiting on a single condition have identical semantics,
103 ** therefore which one gets notified is not significant.
104 **
105 ** The calling thead must hold the lock that protects the condition, as
106 ** well as the invariants that are tightly bound to the condition, when
107 ** notify is called.
108 **
109 ** Returns PR_FAILURE if the caller has not locked the lock associated
110 ** with the condition variable.
111 */
112 NSPR_API(PRStatus) PR_NotifyCondVar(PRCondVar *cvar);
113
114 /*
115 ** Notify all of the threads waiting on the condition variable. The order
116 ** that the threads are notified is indeterminant. The lock that protects
117 ** the condition must be held.
118 **
119 ** Returns PR_FAILURE if the caller has not locked the lock associated
120 ** with the condition variable.
121 */
122 NSPR_API(PRStatus) PR_NotifyAllCondVar(PRCondVar *cvar);
123
124 PR_END_EXTERN_C
125
126 #endif /* prcvar_h___ */
OLDNEW
« no previous file with comments | « gecko-sdk/include/prcpucfg.h ('k') | gecko-sdk/include/prdtoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698