OS_KillThread*

Syntax

#include <nitro/os.h>
void OS_KillThread( OSThread* thread, void* arg );
void OS_KillThreadWithPriority( OSThread* thread, void* arg, u32 prio );

Arguments

None.

thread Pointer to the thread to be terminated
arg Value passed to the thread destructor
prio Thread priority level

Return Values

None.

Description

This terminates the specified thread, then switches to the next executable thread.

OS_KillThread*() is called if a thread destructor has been set in advance using OS_SetThreadDestructor(). The destructor function is defined by

typedef void (*OSThreadDestructor)( void* );

and is a function of OSThreadDestructor type.

thread is the thread to be terminated. arg is passed to the destructor function as its first argument.

When the current thread is specified in thread, the operation is the same as calling OS_ExitThread().

If the thread thread has locked mutex, all locked mutex are unlocked.

OS_KillThreadWithPriority() changes the priority level of the thread to be terminated to prio.

The difference between OS_KillThread*() and OS_DestroyThread() is that a destructor function is called in the case of OS_KillThread*() while a destructor function is not called in the case of OS_DestroyThread().

Be carefule when using OS_KillThread*() Because it suddenly terminates the specified thread thread without any advance warning. If you are going to use this function, be sure you understand the operations of threads.

See Also

OS_InitThread, OS_ExitThread, OS_DestroyThread, OS_SetThreadDestructor

Revision History

2005/07/07 Initial version.


CONFIDENTIAL