enqueue_exn t x f a enqueues an immediate job consuming x tokens, running f on
input a.
if allow_immediate_run is true then f is allowed to run within the same async
job as enqueue_exn iff there are enough tokens available to fully run the job and
there are no other previously enqueued jobs that have not run. If this is the case,
it is run before enqueue_exn returns. Otherwise no part of f is run before
enqueue_exn returns.
If there is a failure associated with this job then the exception will be raised to
the monitor in scope when enqueue_exn is called. Note that it may fail for a
number of reasons, including f throws an exception, the limiter is killed, or the
number of tokens requested is larger than the burst size.
enqueue' t x f a enqueues a deferred job consuming x tokens, running f on
input a. No part of f is run before enqueue' returns.
kills t, which aborts all enqueued jobs that haven't started and all jobs enqueued
in the future. If t has already been killed, then calling kill t has no effect.
Note that kill does not effect currently running jobs in any way.
is_dead t returns true if t was killed, either by kill or by an unhandled
exception in a job.