Megosztás a következőn keresztül:


Context::Unblock Method

Unblocks the context and causes it to become runnable.

virtual void Unblock() =0;

Remarks

It is perfectly legal for a call to the Unblock method to come before a corresponding call to the Block method. As long as calls to the Block and Unblock methods are properly paired, the runtime properly handles the natural race of either ordering. An Unblock call coming before a Block call simply negates the effect of the Block call.

There are several exceptions which can be thrown from this method. If a context attempts to call the Unblock method on itself, a context_self_unblock exception will be thrown. If calls to Block and Unblock are not properly paired (e.g.: two calls to Unblock are made for a context which is currently running), a context_unblock_unbalanced exception will be thrown.

Be aware that there is a critical period between the point where your code publishes its context for another thread to be able to call the Unblock method and the point where the actual method call to Block is made. During this period, it is imperative that you not call any method which may in turn block and unblock for its own reasons (e.g.: acquiring a lock). Calls to the Block and Unblock method do not track the reason for the blocking and unblocking. Only one object should have ownership of a Block and Unblock pair.

Requirements

Header: concrt.h

Namespace: Concurrency

See Also

Reference

Context Class

Context::Block Method

Concepts

Task Scheduler (Concurrency Runtime)