Reputation: 1959
In visual studio, for example, one can freeze/thaw any thread at any time. Is is possible to do this programmatically in order to create a stress test of sorts for threaded code? If any thread could be frozen randomly for a random amount of time, it would really exercise the synchronization logic.
Upvotes: 4
Views: 874
Reputation: 3353
You can do this with SuspendThread & ResumeThread, you'll need the thread handle which you get by calling OpenThread. The thread functions page on msdn is a good resource for this sort of thing.
Upvotes: 3
Reputation: 8852
you can create a Thread
which randomly picks Thread's
from ThreadPool
and put them to sleep for random amount of time. If that's what you are after.
Upvotes: 1