Ejemplo n.º 1
0
Archivo: nrt.c Proyecto: jriehl/numba
static
void nrt_push_meminfo_list(MemInfo * volatile *list, MemInfo *repl) {
    MemInfo *old, *head;
    head = *list;   /* get the current head */
    do {
        old = head; /* old is what CAS compare against */
        /* Set the next item to be the current head */
        repl->list_next = head;
        /* Try to replace the head with the new node.
           The function also perform:
               head <- atomicload(list) */
    } while ( !TheMSys.atomic_cas(list, old, repl, &head) );
}
Ejemplo n.º 2
0
Archivo: nrt.c Proyecto: jriehl/numba
static
MemInfo *nrt_pop_meminfo_list(MemInfo * volatile *list) {
    MemInfo *old, *repl, *head;

    head = *list;     /* get the current head */
    do {
        old = head;   /* old is what CAS compare against */
        if ( head ) {
            /* if head is not NULL, replace with the next item */
            repl = head->list_next;
        } else {
            /* else, replace with NULL */
            repl = NULL;
        }
        /* Try to replace list head with the next node.
           The function also perform:
               head <- atomicload(list) */
    } while ( !TheMSys.atomic_cas(list, old, repl, &head));
    return old;
}