blocking


Description:


[ Version ( since = "0.2.0-alpha" ) ]
public void blocking (VoidTaskFunc func) throws Error

Runs the given blocking task.

If the current thread is not a WorkerThread, this method just runs the task without any further work. Otherwise, this method tries to create a new thread.

-> If succeed, the new thread takes the context of this thread and runs the remaining tasks in the context. This thread runs the blocking task and is marked as blocked until the task ends. After it ends, this thread is unblocked and takes the context back, and the new thread is terminated.

-> If failed, e.g. the maximum number of threads exceeded, this method just runs the function without any further work.

Parameters:

func

a task function

Exceptions:

Error

the error thrown by the function

See also:

Gpseq.blocking_get, WorkerThread.blocking


Namespace: Gpseq
Package: gpseq-1.0