Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
pratom.c File Reference
#include "pratom.h"
#include "primpl.h"
#include <string.h>

Go to the source code of this file.

Functions

void _PR_MD_INIT_ATOMIC (void)
PRInt32 _PR_MD_ATOMIC_INCREMENT (PRInt32 *val)
PRInt32 _PR_MD_ATOMIC_ADD (PRInt32 *ptr, PRInt32 val)
PRInt32 _PR_MD_ATOMIC_DECREMENT (PRInt32 *val)
PRInt32 _PR_MD_ATOMIC_SET (PRInt32 *val, PRInt32 newval)
void _PR_InitAtomic (void)
 PR_AtomicIncrement (PRInt32 *val)
 PR_AtomicDecrement (PRInt32 *val)
 PR_AtomicSet (PRInt32 *val, PRInt32 newval)
 PR_AtomicAdd (PRInt32 *ptr, PRInt32 val)
 PR_CreateStack (const char *stack_name)
 PR_DestroyStack (PRStack *stack)
 PR_StackPush (PRStack *stack, PRStackElem *stack_elem)
 PR_StackPop (PRStack *stack)

Variables

static PRLockatomic_lock = NULL

Function Documentation

Definition at line 298 of file pratom.c.

Here is the caller graph for this function:

PRInt32 _PR_MD_ATOMIC_ADD ( PRInt32 ptr,
PRInt32  val 
)

Definition at line 253 of file pratom.c.

Here is the call graph for this function:

Definition at line 267 of file pratom.c.

Here is the call graph for this function:

Definition at line 239 of file pratom.c.

Here is the call graph for this function:

PRInt32 _PR_MD_ATOMIC_SET ( PRInt32 val,
PRInt32  newval 
)

Definition at line 281 of file pratom.c.

Here is the call graph for this function:

Definition at line 231 of file pratom.c.

{
    if (atomic_lock == NULL) {
        atomic_lock = PR_NewLock();
    }
}

Here is the call graph for this function:

PR_AtomicAdd ( PRInt32 ptr,
PRInt32  val 
)

Definition at line 322 of file pratom.c.

{
    return _PR_MD_ATOMIC_ADD(ptr, val);
}

Here is the caller graph for this function:

Definition at line 310 of file pratom.c.

Definition at line 304 of file pratom.c.

PR_AtomicSet ( PRInt32 val,
PRInt32  newval 
)

Definition at line 316 of file pratom.c.

Here is the caller graph for this function:

PR_CreateStack ( const char *  stack_name)

Definition at line 332 of file pratom.c.

{
PRStack *stack;

    if (!_pr_initialized) {
        _PR_ImplicitInitialization();
    }

    if ((stack = PR_NEW(PRStack)) == NULL) {
              return NULL;
       }
       if (stack_name) {
              stack->prstk_name = (char *) PR_Malloc(strlen(stack_name) + 1);
              if (stack->prstk_name == NULL) {
                     PR_DELETE(stack);
                     return NULL;
              }
              strcpy(stack->prstk_name, stack_name);
       } else
              stack->prstk_name = NULL;

#ifndef _PR_HAVE_ATOMIC_CAS
    stack->prstk_lock = PR_NewLock();
       if (stack->prstk_lock == NULL) {
              PR_Free(stack->prstk_name);
              PR_DELETE(stack);
              return NULL;
       }
#endif /* !_PR_HAVE_ATOMIC_CAS */

       stack->prstk_head.prstk_elem_next = NULL;
       
    return stack;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PR_DestroyStack ( PRStack *  stack)

Definition at line 368 of file pratom.c.

{
       if (stack->prstk_head.prstk_elem_next != NULL) {
              PR_SetError(PR_INVALID_STATE_ERROR, 0);
              return PR_FAILURE;
       }

       if (stack->prstk_name)
              PR_Free(stack->prstk_name);
#ifndef _PR_HAVE_ATOMIC_CAS
       PR_DestroyLock(stack->prstk_lock);
#endif /* !_PR_HAVE_ATOMIC_CAS */
       PR_DELETE(stack);

       return PR_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PR_StackPop ( PRStack *  stack)

Definition at line 398 of file pratom.c.

{
PRStackElem *element;

    PR_Lock(stack->prstk_lock);
       element = stack->prstk_head.prstk_elem_next;
       if (element != NULL) {
              stack->prstk_head.prstk_elem_next = element->prstk_elem_next;
              element->prstk_elem_next = NULL;   /* debugging aid */
       }
    PR_Unlock(stack->prstk_lock);
    return element;
}

Here is the caller graph for this function:

PR_StackPush ( PRStack *  stack,
PRStackElem *  stack_elem 
)

Definition at line 388 of file pratom.c.

{
    PR_Lock(stack->prstk_lock);
       stack_elem->prstk_elem_next = stack->prstk_head.prstk_elem_next;
       stack->prstk_head.prstk_elem_next = stack_elem;
    PR_Unlock(stack->prstk_lock);
    return;
}

Here is the caller graph for this function:


Variable Documentation

PRLock* atomic_lock = NULL [static]

Definition at line 230 of file pratom.c.