Esempio n. 1
0
// Hazard Pointers Specific
void scan()
{

    /* Iteratation variables. */
    mr_node_t *cur;
    int i,j;
    uint8_t my_index = ltd.thread_index;

    shtd[my_index].scan_count++;

    /* List of hazard pointers, and its size. */
    void **plist = ltd.plist;
    size_t psize;

    /*
     * Make sure that the most recent node to be deleted has been unlinked
     * in all processors' views.
     */
    // write_barrier();
    MEM_BARRIER;

    /* Stage 1: Scan HP list and insert non-null values in plist. */
    psize = 0;
    for (i = 0; i < H; i++) {
        if (HP[i].p != NULL) {
            plist[psize++] = HP[i].p;
        }
    }

    /* Stage 3: Free non-harzardous nodes. */


    for (j = 0; j < N_EPOCHS; j++) {

        cur = ltd.limbo_list[j]->tail;
        while (true) {
            
            if (cur == NULL || !is_old_enough(cur)) {
              break;
            }

            if (!ssearch(plist, psize, cur->actual_node)) {
                remove_node(ltd.limbo_list[j], cur);
                ltd.rcount--;
                ssfree_alloc(0, cur->actual_node);
                ssfree_alloc(1, cur);

            }
            cur = cur->mr_prev;
        }
    }
}
Esempio n. 2
0
/* Processes a list of callbacks.
 *
 * @list: Pointer to list of node_t's.
 */
void process_callbacks(double_llist_t *list)
{
    mr_node_t *n;
    uint64_t num = 0;
    
    MEM_BARRIER;

    while (list->head != NULL) {
        n = remove_from_tail(list);
        
        ssfree_alloc(0, n->actual_node);
        ssfree_alloc(1, n);
        num++;
    }

    shtd[ltd.thread_index].process_callbacks_count+=num;
    /* Update our accounting information. */
    ltd.rcount -= num;
}
Esempio n. 3
0
void
ssfree(void* ptr)
{
  ssfree_alloc(0, ptr);
}