Perhaps: https://stackoverflow.com/questions/50818802/how-to-suspend-and-resume-a-posix-thread-in-c
There may be some libraries that can help with this. If not, the idea is to have a test mode that creates a separate thread that suspends and resumes random threads for random durations. This should widen any timing windows, thereby uncovering locking bugs.