Make rndc ThreadSanitizer clean
Currently rndc
fails with:
==================
WARNING: ThreadSanitizer: data race (pid=27100)
Read of size 4 at 0x0001032e66fc by main thread:
#0 main rndc.c:1000 (rndc:x86_64+0x100001aa1)
Previous write of size 4 at 0x0001032e66fc by thread T2:
#0 rndc_connected rndc.c:450 (rndc:x86_64+0x100003532)
#1 dispatch task.c:1128 (rndc:x86_64+0x10003f7e5)
#2 run task.c:1295 (rndc:x86_64+0x10003d168)
Location is global 'connects' at 0x0001032e66fc (rndc+0x00010006f6fc)
Thread T2 (tid=18346395, running) created by main thread at:
#0 pthread_create <null> (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2a17d)
#1 isc_thread_create thread.c:63 (rndc:x86_64+0x100055056)
#2 isc_taskmgr_create task.c:1380 (rndc:x86_64+0x10003cf10)
#3 main rndc.c:935 (rndc:x86_64+0x10000165b)
SUMMARY: ThreadSanitizer: data race rndc.c:1000 in main
==================
==================
WARNING: ThreadSanitizer: data race (pid=27100)
Read of size 4 at 0x0001032e6700 by main thread:
#0 main rndc.c:1000 (rndc:x86_64+0x100001ab6)
Previous write of size 4 at 0x0001032e6700 by thread T2:
#0 rndc_senddone rndc.c:274 (rndc:x86_64+0x100003fb9)
#1 dispatch task.c:1128 (rndc:x86_64+0x10003f7e5)
#2 run task.c:1295 (rndc:x86_64+0x10003d168)
Location is global 'sends' at 0x0001032e6700 (rndc+0x00010006f700)
Thread T2 (tid=18346395, running) created by main thread at:
#0 pthread_create <null> (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2a17d)
#1 isc_thread_create thread.c:63 (rndc:x86_64+0x100055056)
#2 isc_taskmgr_create task.c:1380 (rndc:x86_64+0x10003cf10)
#3 main rndc.c:935 (rndc:x86_64+0x10000165b)
SUMMARY: ThreadSanitizer: data race rndc.c:1000 in main
==================
==================
WARNING: ThreadSanitizer: data race (pid=27100)
Read of size 4 at 0x0001032e6704 by main thread:
#0 main rndc.c:1000 (rndc:x86_64+0x100001acb)
Previous write of size 4 at 0x0001032e6704 by thread T2:
#0 rndc_recvdone rndc.c:294 (rndc:x86_64+0x1000040c3)
#1 dispatch task.c:1128 (rndc:x86_64+0x10003f7e5)
#2 run task.c:1295 (rndc:x86_64+0x10003d168)
Location is global 'recvs' at 0x0001032e6704 (rndc+0x00010006f704)
Thread T2 (tid=18346395, running) created by main thread at:
#0 pthread_create <null> (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2a17d)
#1 isc_thread_create thread.c:63 (rndc:x86_64+0x100055056)
#2 isc_taskmgr_create task.c:1380 (rndc:x86_64+0x10003cf10)
#3 main rndc.c:935 (rndc:x86_64+0x10000165b)
SUMMARY: ThreadSanitizer: data race rndc.c:1000 in main
==================
ThreadSanitizer: reported 3 warnings
Should be fairly easy to fix...