windows - Can a thread call SuspendThread passing its own thread ID? -
can windows thread suspend suspendthread()
?
i can awake 1 but, can call suspendthread(getcurrentthreadid())
?
it seems possible, slight alteration (see cygwin mailing list discussing here):
suspendthread(getcurrentthread());
i found msdn saying thread should suspend itself, doesn't make clear me. quote (from here, emphasis mine):
this function designed use debuggers. not intended used thread synchronization. calling suspendthread on thread owns synchronization object, such mutex or critical section, can lead deadlock if calling thread tries obtain synchronization object owned suspended thread. avoid situation, a thread within application not debugger should signal other thread suspend itself. target thread must designed watch signal , respond appropriately.
Comments
Post a Comment