properly check and log thread cancelability discrepancies
Costa Tsaousis (ktsaou) committed
Jan 3, 2018 at 07:15 UTC
d4c62d8a3b48d9257a37d0934091c26328e14a52
1 file changed
+2
-2
src/locks.c
+2
-2
@@ -29,8 +29,8 @@ inline void netdata_thread_enable_cancelability(void) {
29
if(ret != 0)
30
error("THREAD_CANCELABILITY: pthread_setcancelstate() on thread %s returned error %d", netdata_thread_tag(), ret);
31
else {
32
- if(!old)
33
- error("THREAD_CANCELABILITY: netdata_thread_enable_cancelability(): old thread cancelability on thread %s was changed, expected ENABLED, found DISABLED - please report this!", netdata_thread_tag());
32
+ if(old != PTHREAD_CANCEL_DISABLE)
33
+ error("THREAD_CANCELABILITY: netdata_thread_enable_cancelability(): old thread cancelability on thread %s was changed, expected DISABLED (%d), found %s (%d) - please report this!", netdata_thread_tag(), PTHREAD_CANCEL_DISABLE, (old == PTHREAD_CANCEL_ENABLE)?"ENABLED":"UNKNOWN", old);
34
}
35
36
netdata_thread_lock_cancelability = 0;