Table of Contents
future_acquire - reactivate the calling thread
#include <qthread/futurelib.h>
void
future_acquire (void);
In order to prevent deadlocks over resource
acquisition, threads must yield active status before attempting to create
or join with futures. After completing these actions, the thread reactivates
itself with a call to future_acquire() which blocks until the number of
active threads on its location is below a set threshold.
If a thread calls
the acquire function with an argument which is not a qthread which was
created as a future, the function will do nothing and will not block. This
is acceptable behavior and it is generally expected that threads will attempt
to acquire after creating or joining with futures in the chance that acquisition
is necessary.
The typical sequence for creating futures is:
1) yield
2) loop creating futures
3) [optional: join with futures]
4) acquire
future_join_all(3)
, future_init(3)
, future_exit(3)
,
future_yield(3)
, future_acquire(3)
Table of Contents