Commit Graph

3 Commits

Author SHA1 Message Date
Ben Wagner 6e414d61c7 Extend test thread args lifetime
The argument passed to each thread in test-pthread.c indicates a thread
number to report when finished. This value is read out by the thread
into a local variable early in the thread's execution. Currently, the
address passed as this argument is the address of a loop local. However,
it is possible that the created thread will not be scheduled to run or
will not read the argument before the thread creation loop finishes and
the local is destroyed. This can lead to odd behavior, usually observed
as multiple threads reporting the same thread_num.

Fix this issue by storing the thread arguments in a parallel array to
the array of threads. This ensures that the thread arguments are in
scope as long as the threads themselves.

Discovered with tests/test-pthread with AddressSanitizer enabled.
2021-09-06 04:06:16 +00:00
Akira TAGOH 5918d5bea5 Add missing license headers
https://bugs.freedesktop.org/show_bug.cgi?id=73401
2014-01-17 13:05:25 +09:00
Behdad Esfahbod 7680e9ee89 Add pthread test
Not enabled by default since it requires config and fonts.
2013-01-08 14:51:00 -06:00