]> pd.if.org Git - nbds/blobdiff - runtime/hazard.c
work in progress
[nbds] / runtime / hazard.c
index 3ebed2ee0ca7f267a0926e5f66e662f6216a7d8c..431c57665029b72db1d21c8fd34b90458cce3184 100644 (file)
@@ -53,8 +53,8 @@ static int search_hazards (void *p, haz_t *hazards, int n) {
 
 static void resize_pending (void) {
     TRACE("H2", "haz_resize_pending", 0, 0);
-    LOCALIZE_THREAD_LOCAL(tid_, int);
-    haz_local_t *l = haz_local_ + tid_;
+    LOCALIZE_THREAD_LOCAL(ThreadId, int);
+    haz_local_t *l = haz_local_ + ThreadId;
     pending_t *p = nbd_malloc(sizeof(pending_t) * l->pending_size * 2);
     memcpy(p, l->pending, l->pending_size);
     nbd_free(l->pending);
@@ -66,8 +66,8 @@ void haz_defer_free (void *d, free_t f) {
     TRACE("H1", "haz_defer_free: %p (%p)", d, f);
     assert(d);
     assert(f);
-    LOCALIZE_THREAD_LOCAL(tid_, int);
-    haz_local_t *l = haz_local_ + tid_;
+    LOCALIZE_THREAD_LOCAL(ThreadId, int);
+    haz_local_t *l = haz_local_ + ThreadId;
     while (l->pending_count == l->pending_size) {
 
         if (l->pending_size == 0) {
@@ -131,17 +131,17 @@ haz_t *haz_get_static (int i) {
     TRACE("H1", "haz_get_static: %p", i, 0);
     if (i >= STATIC_HAZ_PER_THREAD)
         return NULL;
-    LOCALIZE_THREAD_LOCAL(tid_, int);
+    LOCALIZE_THREAD_LOCAL(ThreadId, int);
     assert(i < STATIC_HAZ_PER_THREAD);
-    haz_t *ret = &haz_local_[tid_].static_haz[i];
+    haz_t *ret = &haz_local_[ThreadId].static_haz[i];
     TRACE("H1", "haz_get_static: returning %p", ret, 0);
     return ret;
 }
 
 void haz_register_dynamic (haz_t *haz) {
     TRACE("H1", "haz_register_dynamic: %p", haz, 0);
-    LOCALIZE_THREAD_LOCAL(tid_, int);
-    haz_local_t *l = haz_local_ + tid_;
+    LOCALIZE_THREAD_LOCAL(ThreadId, int);
+    haz_local_t *l = haz_local_ + ThreadId;
 
     if (l->dynamic_size == 0) {
         int n = MAX_NUM_THREADS * STATIC_HAZ_PER_THREAD;
@@ -163,8 +163,8 @@ void haz_register_dynamic (haz_t *haz) {
 // assumes <haz> was registered in the same thread
 void haz_unregister_dynamic (void **haz) {
     TRACE("H1", "haz_unregister_dynamic: %p", haz, 0);
-    LOCALIZE_THREAD_LOCAL(tid_, int);
-    haz_local_t *l = haz_local_ + tid_;
+    LOCALIZE_THREAD_LOCAL(ThreadId, int);
+    haz_local_t *l = haz_local_ + ThreadId;
 
     for (int i = 0; i < l->dynamic_count; ++i) {
         if (l->dynamic[i] == haz) {