/* * initialize thread metadata for GC */ void clht_gc_thread_init(clht_t* h, int id) { clht_alloc = (ssmem_allocator_t*) malloc(sizeof(ssmem_allocator_t)); assert(clht_alloc != NULL); ssmem_alloc_init_fs_size(clht_alloc, SSMEM_DEFAULT_MEM_SIZE, SSMEM_GC_FREE_SET_SIZE, id); ht_ts_t* ts = (ht_ts_t*) memalign(CACHE_LINE_SIZE, sizeof(ht_ts_t)); assert(ts != NULL); ts->version = h->ht->version; ts->id = id; do { ts->next = h->version_list; } while (CAS_U64((volatile size_t*) &h->version_list, (size_t) ts->next, (size_t) ts) != (size_t) ts->next); clht_ts_thread = ts; }
/* * initialize allocator a with the default SSMEM_GC_FREE_SET_SIZE * If the thread is not subscribed to the list of timestamps (used for GC), * additionally subscribe the thread to the list */ void ssmem_alloc_init(ssmem_allocator_t* a, size_t size, int id) { return ssmem_alloc_init_fs_size(a, size, SSMEM_GC_FREE_SET_SIZE, id); }