this can also make some other thread spuriously start registering as the main thread  it also only fools one check  but many other things still look like it is the main thread  like tls and what the   fuck   maynotbemainthread  so this is a very limited illusion  if it is just for your particular tests  maybe your code could provide it is own bypass  named ismainthreadortest or something  that can be overridden  ideally  though  we would actually run it off the main thread  since if the code cares about threading we should probably test how it deals with threading  this also seems like it would give tsan a better opportunity to detect bugs  