X-Git-Url: https://pd.if.org/git/?p=nbds;a=blobdiff_plain;f=runtime%2Frcu.c;h=f5e3c3ca27bc53252e447fb99b086b0d863db5a4;hp=dfa49c8652ed277de7eb847716bd61d0f21e96a5;hb=d61d7ffdfa8fab555a5086e61d2e9dfe699a14b9;hpb=efd90a1b8a9d3bbb1bdd8e6ae41b3462e7193fb2 diff --git a/runtime/rcu.c b/runtime/rcu.c index dfa49c8..f5e3c3c 100644 --- a/runtime/rcu.c +++ b/runtime/rcu.c @@ -2,14 +2,15 @@ * Written by Josh Dybnis and released to the public domain, as explained at * http://creativecommons.org/licenses/publicdomain * - * safe memory reclemation using a simple technique from rcu + * safe memory reclamation using a simple technique from rcu + * + * WARNING: not robust enough for real-world use */ #include #include "common.h" -#include "rcu.h" +#include "runtime_local.h" #include "lwt.h" #include "mem.h" -#include "nbd.h" #include "tls.h" #define RCU_POST_THRESHOLD 10 @@ -101,9 +102,9 @@ void nbd_defer_free (void *x) { } #ifdef MAKE_rcu_test -#include #include #include +#include "runtime.h" #define NUM_ITERATIONS 10000000 @@ -152,7 +153,6 @@ node_t *node_alloc (void) { void *worker (void *arg) { int id = (int)(size_t)arg; unsigned int rand_seed = (unsigned int)id + 1; - nbd_thread_init(id); // Wait for all the worker threads to be ready. __sync_fetch_and_add(&wait_, -1); @@ -199,7 +199,7 @@ int main (int argc, char **argv) { pthread_t thread[num_threads]; for (int i = 0; i < num_threads; ++i) { - int rc = pthread_create(thread + i, NULL, worker, (void *)(size_t)i); + int rc = nbd_thread_create(thread + i, i, worker, (void *)(size_t)i); if (rc != 0) { perror("pthread_create"); return rc; } } for (int i = 0; i < num_threads; ++i) {