]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use isc_threadresult_t instead of pthread specific void * return type
authorOndřej Surý <ondrej@sury.org>
Wed, 4 Dec 2019 09:41:40 +0000 (10:41 +0100)
committerOndřej Surý <ondrej@isc.org>
Mon, 13 Jan 2020 08:08:48 +0000 (09:08 +0100)
The ISC thread API already defines isc_threadresult_t type,
but we are using a pthread specific return type (void *).

lib/isc/netmgr/netmgr.c
lib/isc/tests/mem_test.c

index 0fdd215df1d890b8540c7892ed3224485a394d47..fe1f898cb22432c6e5a6e546e9d173dd61c7cb4f 100644 (file)
@@ -53,8 +53,8 @@ static void
 nmsocket_maybe_destroy(isc_nmsocket_t *sock);
 static void
 nmhandle_free(isc_nmsocket_t *sock, isc_nmhandle_t *handle);
-static void *
-nm_thread(void *worker0);
+static isc_threadresult_t
+nm_thread(isc_threadarg_t worker0);
 static void
 async_cb(uv_async_t *handle);
 static void
@@ -406,8 +406,8 @@ isc_nm_tcp_gettimeouts(isc_nm_t *mgr, uint32_t *initial, uint32_t *idle,
  * nm_thread is a single worker thread, that runs uv_run event loop
  * until asked to stop.
  */
-static void *
-nm_thread(void *worker0) {
+static isc_threadresult_t
+nm_thread(isc_threadarg_t worker0) {
        isc__networker_t *worker = (isc__networker_t *) worker0;
 
        isc__nm_tid_v = worker->id;
@@ -496,7 +496,8 @@ nm_thread(void *worker0) {
                                  memory_order_relaxed);
        SIGNAL(&worker->mgr->wkstatecond);
        UNLOCK(&worker->mgr->lock);
-       return (NULL);
+
+       return ((isc_threadresult_t)0);
 }
 
 /*
index c237ef23cd32285832f6373195973bf82ea62090..a923cc58d21c6f41bb34f0817a6b440ed2fb8b30 100644 (file)
@@ -380,8 +380,8 @@ isc_mem_traceflag_test(void **state) {
 #define NUM_ITEMS 1024 //768
 #define ITEM_SIZE 65534
 
-static void *
-mem_thread(void *arg) {
+static isc_threadresult_t
+mem_thread(isc_threadarg_t arg) {
        void *items[NUM_ITEMS];
        size_t size = *((size_t *)arg);
 
@@ -394,7 +394,7 @@ mem_thread(void *arg) {
                }
        }
 
-       return (NULL);
+       return ((isc_threadresult_t)0);
 }
 
 static void
@@ -430,8 +430,8 @@ isc_mem_benchmark(void **state) {
               (nthreads * ITERS * NUM_ITEMS) / (t / 1000000.0));
 }
 
-static void *
-mempool_thread(void *arg) {
+static isc_threadresult_t
+mempool_thread(isc_threadarg_t arg) {
        isc_mempool_t *mp = (isc_mempool_t *)arg;
        void *items[NUM_ITEMS];
 
@@ -444,7 +444,7 @@ mempool_thread(void *arg) {
                }
        }
 
-       return (NULL);
+       return ((isc_threadresult_t)0);
 }
 
 static void