]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use libisc thread functions
authorMukund Sivaraman <muks@isc.org>
Fri, 4 Mar 2016 08:28:35 +0000 (13:58 +0530)
committerMukund Sivaraman <muks@isc.org>
Fri, 4 Mar 2016 08:28:39 +0000 (13:58 +0530)
lib/dns/tests/name_test.c
lib/dns/tests/rbt_test.c

index 7f24860e1b1d71a4c78306dc792f091ec691b075..7c1aab8a45d54fce05f20b4e2d6aac1bbc4bc4ca 100644 (file)
@@ -31,6 +31,7 @@
 #include <isc/mem.h>
 #include <isc/os.h>
 #include <isc/print.h>
+#include <isc/thread.h>
 #include <isc/util.h>
 
 #include <dns/compress.h>
@@ -342,7 +343,7 @@ ATF_TC_BODY(benchmark, tc) {
        isc_time_t ts1, ts2;
        double t;
        unsigned int nthreads;
-       pthread_t threads[32];
+       isc_thread_t threads[32];
 
        UNUSED(tc);
 
@@ -357,19 +358,13 @@ ATF_TC_BODY(benchmark, tc) {
        nthreads = ISC_MIN(isc_os_ncpus(), 32);
        nthreads = ISC_MAX(nthreads, 1);
        for (i = 0; i < nthreads; i++) {
-               int s;
-
-               s = pthread_create(&threads[i], NULL, fromwire_thread, NULL);
-
-               ATF_REQUIRE(s == 0);
+               result = isc_thread_create(fromwire_thread, NULL, &threads[i]);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
        }
 
        for (i = 0; i < nthreads; i++) {
-               int s;
-
-               s = pthread_join(threads[i], NULL);
-
-               ATF_REQUIRE(s == 0);
+               result = isc_thread_join(threads[i], NULL);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
        }
 
        result = isc_time_now(&ts2);
index 4d0ca09757915fe4d56aaec383369bcb95726398..aa100e0edfb3bc92eb0f03cba66a158d454e750e 100644 (file)
@@ -47,6 +47,7 @@
 #include <isc/socket.h>
 #include <isc/stdio.h>
 #include <isc/task.h>
+#include <isc/thread.h>
 #include <isc/timer.h>
 #include <isc/util.h>
 #include <isc/print.h>
@@ -1364,7 +1365,7 @@ ATF_TC_BODY(benchmark, tc) {
        isc_time_t ts1, ts2;
        double t;
        unsigned int nthreads;
-       pthread_t threads[32];
+       isc_thread_t threads[32];
 
        UNUSED(tc);
 
@@ -1407,19 +1408,13 @@ ATF_TC_BODY(benchmark, tc) {
        nthreads = ISC_MIN(isc_os_ncpus(), 32);
        nthreads = ISC_MAX(nthreads, 1);
        for (i = 0; i < nthreads; i++) {
-               int s;
-
-               s = pthread_create(&threads[i], NULL, find_thread, mytree);
-
-               ATF_REQUIRE(s == 0);
+               result = isc_thread_create(find_thread, mytree, &threads[i]);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
        }
 
        for (i = 0; i < nthreads; i++) {
-               int s;
-
-               s = pthread_join(threads[i], NULL);
-
-               ATF_REQUIRE(s == 0);
+               result = isc_thread_join(threads[i], NULL);
+               ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
        }
 
        result = isc_time_now(&ts2);