end_on [function]

end_on( this thread, object event, bool enable = true )

Set or unset an event object that can stop a thread.

An "event" is any object that implements the "convert to bool" behavior. True means 'signaled', false - inactive. When the event is signaled, the thread will be aborted as soon as possible.