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_SwitchThreadCallback</TITLE>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">OS_SetSwitchThreadCallback <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  <CODE>typedef void (*OSSwitchThreadCallback)(<BR>
17           OSThread* from,<BR>
18           OSThread* to );</CODE><BR>
19  <DD><CODE>OSSwitchThreadCallback OS_SetSwitchThreadCallback(<BR>
20            OSSwitchThreadCallback callback );</CODE>
21</DL>
22<H2>Arguments</H2>
23<TABLE border="1" width="100%">
24  <TBODY>
25    <TR>
26      <TD width="13%"><EM><STRONG>callback</STRONG></EM></TD>
27      <TD width="87%">The callback used when threads are switched. Specify NULL to release callback.</TD>
28    </TR>
29  </TBODY>
30</TABLE>
31<H2>Return Values</H2>
32<P>The callback that was specified before this function was called. If none was set, returns NULL.</P>
33<H2>Description</H2>
34<P>This function registers the callback function that is used when a thread context switch is generated.</P>
35<P>Once this callback function is registered, unless it is modified or released, it will be called each time a context switch is generated.</P>
36<P><CODE>callback</CODE> takes 2 arguments. <CODE>from</CODE> is a pointer to the <CODE>OSThread</CODE> structure of the thread that was being executed before the switch. <CODE>to</CODE> is a pointer to the <CODE>OSThread</CODE> structure of the thread that will be executed next. If it is not prepared to execute, this will be NULL.</P>
37<H2>See Also</H2>
38<P><CODE><A href="OS_InitThread.html">OS_InitThread</A>, <A href="OS_RescheduleThread.html">OS_RescheduleThread</A></CODE></P>
39<H2>Revision History</H2>
40<P>2004/03/31 Initial version.</P>
41<hr><p>CONFIDENTIAL</p></body>
42</HTML>