[ Version ( since = "0.2.0-alpha" ) ]
public G blocking<G> (TaskFunc<G> func) throws Error
Runs the given blocking task and returns the result.
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.
This method must be called in this thread.
func |
a task function |
the result produced by the function |
Error |
the error thrown by the function |