Compiling with -fsanitize=thread gives the following error on the school mac
WARNING: ThreadSanitizer: data race (pid=2438)
Write of size 4 at 0x7ffee1d15760 by thread T54 (mutexes: write M244, write M16):
\#0 messages <null>:2 (philo:x86_64+0x1000038bc)
#1 supervisor <null>:2 philo:x86_64+0x1000030fa)
Previous read of size 4 at 0x7ffee1d15760 by thread T10:
\#0 supervisor <null>:2 (philo:x86_64+0x10000306a)
Location is stack of main thread.
Mutex M244 (0x7ba800000c58) created at:
\#0 pthread_mutex_init <null>:3 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2e913)
\#1 init_philos <null>:2 (philo:x86_64+0x1000022a1)
\#2 init <null>:2 (philo:x86_64+0x10000274e)
\#3 main <null>:2 (philo:x86_64+0x1000019ab)
Mutex M16 (0x7ffee1d157d8) created at:
\#0 pthread_mutex_init <null>:3 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2e913)
\#1 init_data <null>:2 (philo:x86_64+0x10000265d)
\#2 init <null>:2 (philo:x86_64+0x1000026f4)
\#3 main <null>:2 (philo:x86_64+0x1000019ab)
Thread T54 (tid=91819, running) created by thread T53 at:
\#0 pthread_create <null>:3 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2d8fd)
\#1 routine <null>:2 (philo:x86_64+0x100003334)
Thread T10 (tid=91775, running) created by thread T9 at:
\#0 pthread_create <null>:3 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2d8fd)
\#1 routine <null>:2 (philo:x86_64+0x100003334)
SUMMARY: ThreadSanitizer: data race (philo:x86_64+0x1000038bc) in messages+0x16c
==================
ThreadSanitizer: reported 1 warnings
[1] 2438 abort ./philo 200 800 200 200
also when running the below prompt : ./philo 200 800 200 200
a philosopher dies but he is not supposed to according to the subject.
Compiling with -fsanitize=thread gives the following error on the school mac
also when running the below prompt : ./philo 200 800 200 200
a philosopher dies but he is not supposed to according to the subject.