pthread_create(&t->id, NULL, internal_thread_func, t) already
assigns the t->id parameter during the thread construction.
There shouldn't be need to redo this again.
If the system is configured with the thread sanitizer, with meson:
'meson -Db_sanitize=thread', it's apparent that the unnecessary
assignment only causes potential trouble:
08:06:11 MAKE_CHECK='1' /home/test/pulse/pulseaudio/build/src/tests/once-test
Running suite(s): Once
0%: Checks: 1, Failures: 0, Errors: 1
../src/tests/once-test.c:119:E:once:once_test:0: (after this point) Early exit with return value 66
WARNING: ThreadSanitizer: data race (pid=102975)
Read of size 8 at 0x7b0c000012c0 by main thread:
#0 pa_thread_join ../src/pulsecore/thread-posix.c:143 (libpulsecommon-13.99.so+0x8aca4)
#1 once_test ../src/tests/once-test.c:105 (once-test+0x2b13)
#2 srunner_run <null> (once-test+0x58e5)
#3 __libc_start_main <null> (libc.so.6+0x270b2)
Previous write of size 8 at 0x7b0c000012c0 by thread T61:
#0 internal_thread_func ../src/pulsecore/thread-posix.c:76 (libpulsecommon-13.99.so+0x8a715)
#1 <null> <null> (libtsan.so.0+0x2d1af)
Location is heap block of size 40 at 0x7b0c000012c0 allocated by main thread:
#0 calloc <null> (libtsan.so.0+0x305ca)
#1 pa_xmalloc0 ../src/pulse/xmalloc.c:74 (libpulse.so.0+0x6355b)
#2 _pa_xnew0_internal ../src/pulse/xmalloc.h:75 (libpulsecommon-13.99.so+0x8a267)
#3 pa_thread_new ../src/pulsecore/thread-posix.c:92 (libpulsecommon-13.99.so+0x8a828)
#4 once_test ../src/tests/once-test.c:102 (once-test+0x2a98)
#5 srunner_run <null> (once-test+0x58e5)
#6 __libc_start_main <null> (libc.so.6+0x270b2)
Thread T61 'once' (tid=110679, finished) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x5ea99)
#1 pa_thread_new ../src/pulsecore/thread-posix.c:97 (libpulsecommon-13.99.so+0x8a8aa)
#2 once_test ../src/tests/once-test.c:102 (once-test+0x2a98)
#3 srunner_run <null> (once-test+0x58e5)
#4 __libc_start_main <null> (libc.so.6+0x270b2)
SUMMARY: ThreadSanitizer: data race ../src/pulsecore/thread-posix.c:143 in pa_thread_join
ThreadSanitizer: reported 1 warnings
Fix this warning by removing the unnecessary assignment.
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>