ct_enqueue
The ct_enqueue function enqueues a specified thread for execution
at the highest priority.
Prototype:
int ct_enqueue( Ct_handle thread );
Parameters:
- thread
-
Identifies the thread to be enqueued for execution. This value must
have been returned from
ct_create_thread(),
ct_create_sleeping_thread(),
or ct_self(). Otherwise the results are
undefined.
Return Value:
CT_OKAY if successful, or CT_ERROR if not.
Discussion:
When the scheduler regains control, it enqueues the specified thread
in the highest priority run queue. If the thread has expired, the
scheduler silently ignores the enqueue request.
A thread may enqueue itself, though it may still have to wait for other
threads to run before it runs again. In all other cases Cheap Threads
guarantees that the thread to be enqueued will run before the current
thread runs again.
ct_enqueue() has the same effect as
ct_send_msg(), except that it does not
deliver a message. As a result the thread does not need to examine or
dequeue a message.
Restrictions:
Normally ct_enqueue() will be called from a thread or user exit,
i.e. while the scheduler is running. It is also possible to call
ct_enqueue() before the scheduler runs, provided that the specified
thread has already been created.
After the scheduler has finished, calling ct_enqueue() invokes
undefined behavior.
Home