1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>OS_KillThread*</TITLE>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">OS_KillThread* <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></H1>
12<H2>Syntax</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;nitro/os.h&gt;</CODE></PRE>
16  <PRE><CODE>void OS_KillThread( OSThread* thread, void* arg );</CODE></PRE>
17  <PRE><CODE>void OS_KillThreadWithPriority( OSThread* thread, void* arg, u32 prio );</CODE></PRE>
18</DL>
19<H2>Arguments</H2>
20<P>None.</P>
21<TABLE border="1">
22  <TBODY>
23    <TR>
24      <TD><EM><B>thread</B></EM></TD>
25      <TD>Pointer to the thread to be terminated</TD>
26    </TR>
27    <TR>
28      <TD><EM><B>arg</B></EM></TD>
29      <TD>Value passed to the thread destructor</TD>
30    </TR>
31    <TR>
32      <TD><EM><B>prio</B></EM></TD>
33      <TD>Thread priority level</TD>
34    </TR>
35  </TBODY>
36</TABLE>
37<H2>Return Values</H2>
38<P>None.</P>
39<H2>Description</H2>
40<P>This terminates the specified thread, then switches to the next executable thread.</P>
41<P><CODE>OS_KillThread*()</CODE> is called if a thread destructor has been set in advance using <CODE><A href="OS_SetThreadDestructor.html">OS_SetThreadDestructor()</A></CODE>. The destructor function is defined by</P>
42<BLOCKQUOTE><CODE>typedef void (*OSThreadDestructor)( void* );</CODE></BLOCKQUOTE>
43<P>and is a function of <CODE>OSThreadDestructor</CODE> type.</P>
44<P><EM><B>thread</B></EM> is the thread to be terminated. <EM><B>arg</B></EM> is passed to the destructor function as its first argument.</P>
45<P>When the current thread is specified in <EM><B>thread</B></EM>, the operation is the same as calling <CODE><A href="OS_ExitThread.html">OS_ExitThread()</A></CODE>.</P>
46<P>If the thread <CODE>thread</CODE> has locked <CODE>mutex</CODE>, all locked mutex are unlocked.</P>
47<P><CODE>OS_KillThreadWithPriority()</CODE> changes the priority level of the thread to be terminated to <EM><B>prio</B></EM>.</P>
48<P>The difference between <CODE>OS_KillThread*()</CODE> and <CODE><A href="OS_DestroyThread.html">OS_DestroyThread()</A></CODE> is that a destructor function is called in the case of <CODE>OS_KillThread*()</CODE> while a destructor function is not called in the case of <CODE><A href="OS_DestroyThread.html">OS_DestroyThread()</A></CODE>.</P>
49<P>Be carefule when using <CODE>OS_KillThread*()</CODE> Because it suddenly terminates the specified thread <EM><B>thread</B></EM> without any advance warning. If you are going to use this function, be sure you understand the operations of threads.</P>
50<H2>See Also</H2>
51<P><CODE><A href="OS_InitThread.html">OS_InitThread</A>, <A href="OS_ExitThread.html">OS_ExitThread</A>, <A href="OS_DestroyThread.html">OS_DestroyThread</A>, <A href="OS_SetThreadDestructor.html">OS_SetThreadDestructor</A></CODE></P>
52<H2>Revision History</H2>
53<P>2005/07/07 Initial version.</P>
54<hr><p>CONFIDENTIAL</p></body>
55</HTML>