Open matanui159 opened 1 day ago
This was discussed briefly in chat, it seems like we should ensure that the CS tokens are !Send and !Sync.
This could likely be done in a 1.2 release (and yank older versions), as it is a fix for soundness, and any uses like this would be unsound.
Allowing the
CriticalSection
to be bothSend
andSync
allows multiple threads to gain access to a resource by sharing it between threads. For example withstd
this could be done without anyunsafe
code:This causes undefined behaviour and often crashes: