Back to index

lightning-sunbird  0.9+nobinonly
Functions
prmon.c File Reference
#include "primpl.h"

Go to the source code of this file.

Functions

 PR_IMPLEMENT (PRMonitor *)
 PR_IMPLEMENT (void)
 PR_IMPLEMENT (PRBool)
 PR_IMPLEMENT (PRStatus)
 PR_IMPLEMENT (PRIntn)
PRUint32 _PR_MonitorToString (PRMonitor *mon, char *buf, PRUint32 buflen)

Function Documentation

PRUint32 _PR_MonitorToString ( PRMonitor mon,
char *  buf,
PRUint32  buflen 
)

Definition at line 210 of file prmon.c.

{
    PRUint32 nb;

    if (mon->cvar->lock->owner) {
       nb = PR_snprintf(buf, buflen, "[%p] owner=%d[%p] count=%ld",
                      mon, mon->cvar->lock->owner->id,
                      mon->cvar->lock->owner, mon->entryCount);
    } else {
       nb = PR_snprintf(buf, buflen, "[%p]", mon);
    }
    return nb;
}

Here is the call graph for this function:

Definition at line 45 of file prmon.c.

{
    PRMonitor *mon;
       PRCondVar *cvar;
       PRLock *lock;

    mon = PR_NEWZAP(PRMonitor);
    if (mon) {
              lock = PR_NewLock();
           if (!lock) {
                     PR_DELETE(mon);
                     return 0;
       }

           cvar = PR_NewCondVar(lock);
           if (!cvar) {
              PR_DestroyLock(lock);
                     PR_DELETE(mon);
                     return 0;
       }
       mon->cvar = cvar;
       mon->name = NULL;
    }
    return mon;
}

Here is the call graph for this function:

Definition at line 84 of file prmon.c.

{
       PR_DestroyLock(mon->cvar->lock);
    PR_DestroyCondVar(mon->cvar);
    PR_DELETE(mon);
}

Here is the call graph for this function:

Definition at line 109 of file prmon.c.

{
    if (mon->cvar->lock->owner == _PR_MD_CURRENT_THREAD()) {
              mon->entryCount++;
              return PR_TRUE;
    } else {
              if (PR_TestAndLock(mon->cvar->lock)) {
              mon->entryCount = 1;
                     return PR_TRUE;
              }
    }
    return PR_FALSE;
}

Definition at line 126 of file prmon.c.

{
    if (mon->cvar->lock->owner != _PR_MD_CURRENT_THREAD()) {
        return PR_FAILURE;
    }
    if (--mon->entryCount == 0) {
              return PR_Unlock(mon->cvar->lock);
    }
    return PR_SUCCESS;
}
PR_IMPLEMENT ( PRIntn  )

Definition at line 141 of file prmon.c.

{
    return (mon->cvar->lock->owner == _PR_MD_CURRENT_THREAD()) ?
        mon->entryCount : 0;
}