]> pd.if.org Git - nbds/blobdiff - struct/ht_test.c
free its keys too when freeing a ht
[nbds] / struct / ht_test.c
index e8fcc4c299489355eb4cdb88b1e17eae9bf1308b..fd7652446706cd55a2a59dab1db106184a017f18 100644 (file)
@@ -93,7 +93,7 @@ void *simple_worker (void *arg) {
     hash_table_t *ht = wd->ht;
     CuTest* tc = wd->tc;
     uint64_t d = wd->id;
-    int iters = 20000;
+    int iters = 1000000;
 
     SYNC_ADD(wd->wait, -1);
     do { } while (*((volatile worker_data_t *)wd)->wait); // wait for all workers to be ready
@@ -130,8 +130,8 @@ void simple_add_remove (CuTest* tc) {
         wd[i].tc = tc;
         wd[i].ht = ht;
         wd[i].wait = &wait;
-        int rc = pthread_create(thread + i, NULL, simple_worker, wd + i);
-        if (rc != 0) { perror("pthread_create"); return; }
+        int rc = nbd_thread_create(thread + i, i, simple_worker, wd + i);
+        if (rc != 0) { perror("nbd_thread_create"); return; }
     }
     for (i = 0; i < 2; ++i) {
         pthread_join(thread[i], NULL);