winapi - NtWaitForKeyedEvent alertable? -
winapi - NtWaitForKeyedEvent alertable? -
i'm using windows keyed events custom synchronization primitives, inspired http://locklessinc.com/articles/keyed_events/ back upwards thread interruption, i've changed places blocking calls sleep or waitforsingleobject used alertable versions sleepex , waitforsingleobjectex. can interrupt wait queueing apc queueuserapc , if returns wait_io_completion throw special exception causes destructors called , thread exit. similar linux version of pthread_cancel() causes stack unwind , stuff cleaned when thread exits. see ntwaitforkeyedevent() has alertable parameter well, i'm wondering if can same thing case, or there caveats? if apc wake up, don't know homecoming value for, since ntstatus not straight correspond win32 homecoming codes. there status_user_apc , status_alerted , don't know if either of two. if user apc function not sufficient alert keyed event wait, is?
ntwaitforkeyedevent altertable = true want. that's parameter set ntwaitforsingleobject enable reciept of apcs well.
you recieve status_user_apc if wait completed due apc beingness run , status_alerted if ntalertthread called in connection thread. if want signal stop wait, ntalertthread sufficient.
if exception handling mechanism seh unwinds can throw special exception straight apc routine.
winapi asynchronous synchronization apc
Comments
Post a Comment