osStopThread osStopThread (function)

Suspends a given thread

Syntax

#include <ultra64.h>     /* ultra64.h */
void osStopThread(OSThread *t);

Description

osStopThread suspends the given thread (t), preventing it from becoming runnable until a subsequence call to osStartThread on the same thread. If t is NULL, the running thread is stopped and the dispatcher is invoked to run the new highest priority runnable thread. If 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 message. In these cases, osStopThread simply removes the thread from the queue it is on. Call the osStartThread function to restore the thread to that queue. This method of implementation, though efficient, has some side effects. Intuitively, you might expect the following sequence to have no effect:

osStopThread(t);
osStartThread(t);


However, because the thread (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.

See Also

osCreateThread, osGetThreadId, osGetThreadPri, osStartThread, and osYieldThread

Revision History

1999/04/30 Changed Format