osStopThread.3p 1.28 KB
.TH osStartThread 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
osStopThread \- suspend a thread
.SH SYNOPSIS
.nf
\f3
.Op c
#include <ultra64.h>
.sp .8v
void osStopThread(OSThread \(**t);
.Op
\f1
.fi
.SH DESCRIPTION
The
.I osStopThread
call will suspend the given thread
.IR t ,
preventing it from becoming runnable until a subsequence call to
.I osStartThread
on the same thread.
If
.I t
is NULL,
the running thread is stopped and the dispatcher is invoked to run the new
highest priority runnable thread.
If
.I t
is not the invoking thread,
it should either be on the run queue or on a queue of threads blocked to
send or receive a mesage.
In these cases,
.I osStopThread
simply removes the thread from the queue it is on.
The
.I osStartThread
call will restore the thread to that queue.
.PP
This method of implementation,
though efficient,
has some side effects.
Intuitively,
one would expect the following sequence to have no effect:
.Ex
osStopThread(t);
osStartThread(t);
.Ee
Due to the fact that the thread
.I t
is removed and then reinserted into the queue,
it will be moved after all of the other threads of the same priority,
and cause a change in behavior.
.SH "SEE ALSO"
.IR osCreateThread (3P),
.IR osGetThreadId (3P),
.IR osGetThreadPri (3P),
.IR osStartThread (3P),
.IR osYieldThread (3P)