nsprpub/pr/include/prpdce.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7 * File: prpdce.h
michael@0 8 * Description: This file is the API defined to allow for DCE (aka POSIX)
michael@0 9 * thread emulation in an NSPR environment. It is not the
michael@0 10 * intent that this be a fully supported API.
michael@0 11 */
michael@0 12
michael@0 13 #if !defined(PRPDCE_H)
michael@0 14 #define PRPDCE_H
michael@0 15
michael@0 16 #include "prlock.h"
michael@0 17 #include "prcvar.h"
michael@0 18 #include "prtypes.h"
michael@0 19 #include "prinrval.h"
michael@0 20
michael@0 21 PR_BEGIN_EXTERN_C
michael@0 22
michael@0 23 #define _PR_NAKED_CV_LOCK (PRLock*)0xdce1dce1
michael@0 24
michael@0 25 /*
michael@0 26 ** Test and acquire a lock.
michael@0 27 **
michael@0 28 ** If the lock is acquired by the calling thread, the
michael@0 29 ** return value will be PR_SUCCESS. If the lock is
michael@0 30 ** already held, by another thread or this thread, the
michael@0 31 ** result will be PR_FAILURE.
michael@0 32 */
michael@0 33 NSPR_API(PRStatus) PRP_TryLock(PRLock *lock);
michael@0 34
michael@0 35 /*
michael@0 36 ** Create a naked condition variable
michael@0 37 **
michael@0 38 ** A "naked" condition variable is one that is not created bound
michael@0 39 ** to a lock. The CV created with this function is the only type
michael@0 40 ** that may be used in the subsequent "naked" condition variable
michael@0 41 ** operations (see PRP_NakedWait, PRP_NakedNotify, PRP_NakedBroadcast);
michael@0 42 */
michael@0 43 NSPR_API(PRCondVar*) PRP_NewNakedCondVar(void);
michael@0 44
michael@0 45 /*
michael@0 46 ** Destroy a naked condition variable
michael@0 47 **
michael@0 48 ** Destroy the condition variable created by PR_NewNakedCondVar.
michael@0 49 */
michael@0 50 NSPR_API(void) PRP_DestroyNakedCondVar(PRCondVar *cvar);
michael@0 51
michael@0 52 /*
michael@0 53 ** Wait on a condition
michael@0 54 **
michael@0 55 ** Wait on the condition variable 'cvar'. It is asserted that
michael@0 56 ** the lock protecting the condition 'lock' is held by the
michael@0 57 ** calling thread. If more time expires than that declared in
michael@0 58 ** 'timeout' the condition will be notified. Waits can be
michael@0 59 ** interrupted by another thread.
michael@0 60 **
michael@0 61 ** NB: The CV ('cvar') must be one created using PR_NewNakedCondVar.
michael@0 62 */
michael@0 63 NSPR_API(PRStatus) PRP_NakedWait(
michael@0 64 PRCondVar *cvar, PRLock *lock, PRIntervalTime timeout);
michael@0 65
michael@0 66 /*
michael@0 67 ** Notify a thread waiting on a condition
michael@0 68 **
michael@0 69 ** Notify the condition specified 'cvar'.
michael@0 70 **
michael@0 71 ** NB: The CV ('cvar') must be one created using PR_NewNakedCondVar.
michael@0 72 */
michael@0 73 NSPR_API(PRStatus) PRP_NakedNotify(PRCondVar *cvar);
michael@0 74
michael@0 75 /*
michael@0 76 ** Notify all threads waiting on a condition
michael@0 77 **
michael@0 78 ** Notify the condition specified 'cvar'.
michael@0 79 **
michael@0 80 ** NB: The CV ('cvar') must be one created using PR_NewNakedCondVar.
michael@0 81 */
michael@0 82 NSPR_API(PRStatus) PRP_NakedBroadcast(PRCondVar *cvar);
michael@0 83
michael@0 84 PR_END_EXTERN_C
michael@0 85
michael@0 86 #endif /* PRPDCE_H */

mercurial