When dealing with GCD worker threads, TSan currently prints weird things like "created by thread T-1" and "[failed to restore the stack]" in reports:
================== WARNING: ThreadSanitizer: data race (pid=18771) Write of size 8 at 0x00010ac221a0 by thread T3: ... Previous write of size 8 at 0x00010ac221a0 by thread T1: ... Location is global 'global' at 0x00010ac221a0 (workerthreads.mm.tmp+0x0001000021a0) Thread T3 (tid=5981759, running) created by thread T-1 [failed to restore the stack] Thread T1 (tid=5981757, running) created by thread T-1 [failed to restore the stack] SUMMARY: ThreadSanitizer: data race workerthreads.mm:23 in __main_block_invoke_2 ==================
This patch tries to avoid that and instead print:
================== WARNING: ThreadSanitizer: data race (pid=18843) Write of size 8 at 0x0001044431a0 by thread T3: ... Previous write of size 8 at 0x0001044431a0 by thread T1: ... Location is global 'global' at 0x0001044431a0 (workerthreads.mm.tmp+0x0001000021a0) Thread T3 (tid=5989400, running) is a GCD worker thread Thread T1 (tid=5989398, running) is a GCD worker thread SUMMARY: ThreadSanitizer: data race workerthreads.mm:23 in __main_block_invoke_2 ==================