Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsslocks.h File Reference
#include "seccomon.h"
#include "nssilock.h"
#include "prmon.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

SEC_BEGIN_PROTOS SECStatus nss_InitLock (PZLock **ppLock, nssILockType ltype)
SECStatus nss_InitMonitor (PZMonitor **ppMonitor, nssILockType ltype)

Function Documentation

Definition at line 80 of file nsslocks.c.

{
    return __nss_InitLock(ppLock, ltype);
}
SECStatus nss_InitMonitor ( PZMonitor **  ppMonitor,
nssILockType  ltype 
)

Definition at line 91 of file nsslocks.c.

{
    static PRInt32  initializers;

    PORT_Assert( ppMonitor != NULL);

    /* atomically initialize the lock */
    while (!*ppMonitor) {
        PRInt32 myAttempt = PR_AtomicIncrement(&initializers);
        if (myAttempt == 1) {
            if (!*ppMonitor) {
                *ppMonitor = PZ_NewMonitor(ltype);
            }
            (void) PR_AtomicDecrement(&initializers);
            break;
        }
        PR_Sleep(PR_INTERVAL_NO_WAIT);          /* PR_Yield() */
        (void) PR_AtomicDecrement(&initializers);
    }

    return (*ppMonitor != NULL) ? SECSuccess : SECFailure;
}