config BUGFIX workaround for atomic_load spec bug
In the original C11, atomic_load did not work
with const variables.
Refs #253
diff --git a/src/session_client.c b/src/session_client.c
index 8784ba5..a6ab232 100644
--- a/src/session_client.c
+++ b/src/session_client.c
@@ -2214,7 +2214,7 @@
free(ntarg);
/* remember our allocated tid, we will be freeing it */
- ntf_tid = ATOMIC_LOAD(session->opts.client.ntf_tid);
+ ntf_tid = (pthread_t *)ATOMIC_LOAD(session->opts.client.ntf_tid);
while (ATOMIC_LOAD(session->opts.client.ntf_tid)) {
msgtype = nc_recv_notif(session, NC_CLIENT_NOTIF_THREAD_SLEEP / 1000, ¬if);
@@ -2235,7 +2235,7 @@
}
VRB("Session %u: notification thread exit.", session->id);
- ATOMIC_STORE(session->opts.client.ntf_tid, NULL);
+ ATOMIC_STORE(session->opts.client.ntf_tid, (uintptr_t)NULL);
free(ntf_tid);
return NULL;
}
@@ -2276,14 +2276,14 @@
return -1;
}
/* just so that nc_recv_notif_thread() does not immediately exit, the value does not matter */
- ATOMIC_STORE(session->opts.client.ntf_tid, tid);
+ ATOMIC_STORE(session->opts.client.ntf_tid, (uintptr_t)tid);
ret = pthread_create(tid, NULL, nc_recv_notif_thread, ntarg);
if (ret) {
ERR("Session %u: failed to create a new thread (%s).", strerror(errno));
free(ntarg);
free(tid);
- ATOMIC_STORE(session->opts.client.ntf_tid, NULL);
+ ATOMIC_STORE(session->opts.client.ntf_tid, (uintptr_t)NULL);
return -1;
}