Back to index

lightning-sunbird  0.9+nobinonly
Functions
btmon.c File Reference
#include <kernel/OS.h>
#include "primpl.h"

Go to the source code of this file.

Functions

 PR_NewMonitor (void)
 PR_IMPLEMENT (PRMonitor *)
 PR_DestroyMonitor (PRMonitor *mon)
 PR_EnterMonitor (PRMonitor *mon)
 PR_ExitMonitor (PRMonitor *mon)
 PR_Wait (PRMonitor *mon, PRIntervalTime ticks)
 PR_Notify (PRMonitor *mon)
 PR_NotifyAll (PRMonitor *mon)
 PR_GetMonitorEntryCount (PRMonitor *mon)

Function Documentation

Definition at line 98 of file btmon.c.

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 111 of file btmon.c.

{
    if( mon->cvar->lock->owner == find_thread( NULL ) )
    {
       mon->entryCount++;

    } else
    {
       PR_Lock( mon->cvar->lock );
       mon->entryCount = 1;
    }
}

Definition at line 130 of file btmon.c.

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

Definition at line 215 of file btmon.c.

{
    return( mon->entryCount );
}

Here is the caller graph for this function:

Definition at line 81 of file btmon.c.

{
    PRMonitor* mon = PR_NewMonitor();
    if( mon )
    {
        mon->name = name;
    }
    return mon;
}

Here is the call graph for this function:

Definition at line 50 of file btmon.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:

Here is the caller graph for this function:

PR_Notify ( PRMonitor mon)

Definition at line 186 of file btmon.c.

{
    if( mon->cvar->lock->owner != find_thread( NULL ) )
    {
       return( PR_FAILURE );
    }

    PR_NotifyCondVar( mon->cvar );
    return( PR_SUCCESS );
}

Here is the call graph for this function:

Here is the caller graph for this function:

PR_NotifyAll ( PRMonitor mon)

Definition at line 203 of file btmon.c.

{
    if( mon->cvar->lock->owner != find_thread( NULL ) )
    {
       return( PR_FAILURE );
    }

    PR_NotifyAllCondVar( mon->cvar );
    return( PR_SUCCESS );
}

Here is the call graph for this function:

Here is the caller graph for this function:

PR_Wait ( PRMonitor mon,
PRIntervalTime  ticks 
)

Definition at line 160 of file btmon.c.

{
    PRUint32 entryCount;
    PRUintn  status;
    PRThread *meThread;
    thread_id me = find_thread( NULL );
    meThread = PR_GetCurrentThread();

    if( mon->cvar->lock->owner != me ) return( PR_FAILURE );

    entryCount = mon->entryCount;
    mon->entryCount = 0;

    status = PR_WaitCondVar( mon->cvar, ticks );

    mon->entryCount = entryCount;

    return( status );
}

Here is the call graph for this function:

Here is the caller graph for this function: