> It seems like the only reliable way to fix this is to change these functions so that they exclusively acquire a mutex.
A mutex can ensure thread safety but risks deadlocks if not used carefully and will hurt performance...
A mutex can ensure thread safety but risks deadlocks if not used carefully and will hurt performance...