Closed jyn514 closed 5 years ago
This has gone away, instead we get data race
for interrupted
, which is fine since it's not a giant deal if a thread misses an interrupt.
WARNING: ThreadSanitizer: data race (pid=18291)
Write of size 4 at 0x0000014ce9f8 by main thread:
#0 cleanup /home/joshua/src/c/threaded/src/main.c:81:15 (main+0x4b8c4f)
#1 __tsan::ProcessPendingSignals(__tsan::ThreadState*) <null> (main+0x4266ab)
#2 main /home/joshua/src/c/threaded/src/main.c:160:24 (main+0x4b91db)
Previous read of size 4 at 0x0000014ce9f8 by thread T17:
#0 respond /home/joshua/src/c/threaded/src/main.c:71:9 (main+0x4b8bac)
Location is global 'interrupted' of size 4 at 0x0000014ce9f8 (main+0x0000014ce9f8)
Thread T17 (tid=18447, finished) created by main thread at:
#0 pthread_create <null> (main+0x427286)
#1 main /home/joshua/src/c/threaded/src/main.c:169:7 (main+0x4b924a)
SUMMARY: ThreadSanitizer: data race /home/joshua/src/c/threaded/src/main.c:81:15 in cleanup
If and only if I compile with
-fsanitize=thread
, I get a bunch of scary errors on interrupts:Moreover, the process freezes and doesn't respond until I
kill -9
it. Sometimes I don't get the warning but the process will still freeze. GDB points to a syscall deep inaccept
as the currently executing function, which doesn't look right.