class Stud::Task

A Task spawns a thread to execute the given block. execution completion and result retrieval is done using the Task#wait method. A Task is run once and the thread exists upon block completion. A task and its underlying thread are not reusable.

Task does not provide a mean to force-interrupt a running task, it only provides the stop! method to signal the task for a stop request. The task or code block can use the stop? method to check for a stop request. Note that the stop! and stop? methods are thread safe.