mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 08:47:35 +02:00
WIP
This commit is contained in:
parent
bd11b9c7fa
commit
6d1c73b7b4
1 changed files with 15 additions and 10 deletions
|
@ -94,16 +94,21 @@ ck_array_commit(ck_array_t *array);
|
||||||
|
|
||||||
// Can we safely lock the array, make a copy, and interate over that????
|
// Can we safely lock the array, make a copy, and interate over that????
|
||||||
#define CK_ARRAY_FOREACH(a, i, b) \
|
#define CK_ARRAY_FOREACH(a, i, b) \
|
||||||
TODO:
|
pthread_mutex_lock(&(a->lock));
|
||||||
pthread_mutex_lock(&(array->lock));
|
size_t *tmp = calloc(a->hs->nitems, sizeof(struct hashset_st));
|
||||||
hashset_remove(array->hs, pointer);
|
int tmpc = a->hs->nitems;
|
||||||
pthread_mutex_unlock(&(array->lock));
|
// TODO: just do this in the loop below, this is unnecessary
|
||||||
// (i)->snapshot = ck_pr_load_ptr(&(a)->active);
|
for (unsigned int tmpi = 0, tmpii = 0; tmpi < tmpc; tmpi++) {
|
||||||
// ck_pr_fence_load();
|
if (a->hs->items != 0 && a->hs->items != 1) {
|
||||||
// for (unsigned int _ck_i = 0;
|
tmp[tmpii] = a->hs->items[tmpi];
|
||||||
// _ck_i < (a)->active->n_committed &&
|
tmpii++;
|
||||||
// ((*b) = (a)->active->values[_ck_i], 1);
|
}
|
||||||
// _ck_i++)
|
}
|
||||||
|
pthread_mutex_unlock(&(a->lock));
|
||||||
|
for (unsigned int _ck_i = 0;
|
||||||
|
_ck_i < (a)->active->n_committed &&
|
||||||
|
((*b) = (a)->active->values[_ck_i], 1);
|
||||||
|
_ck_i++)
|
||||||
|
|
||||||
// CAS section
|
// CAS section
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Add table
Reference in a new issue