From: Mukund Sivaraman Date: Fri, 4 Mar 2016 08:28:35 +0000 (+0530) Subject: Use libisc thread functions X-Git-Tag: v9.11.0a1~81 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=051197362ba480595c075c95b20e160b980a05c7;p=thirdparty%2Fbind9.git Use libisc thread functions --- diff --git a/lib/dns/tests/name_test.c b/lib/dns/tests/name_test.c index 7f24860e1b1..7c1aab8a45d 100644 --- a/lib/dns/tests/name_test.c +++ b/lib/dns/tests/name_test.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -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); diff --git a/lib/dns/tests/rbt_test.c b/lib/dns/tests/rbt_test.c index 4d0ca097579..aa100e0edfb 100644 --- a/lib/dns/tests/rbt_test.c +++ b/lib/dns/tests/rbt_test.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -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);