1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="Microsoft FrontPage 5.0">
7<META http-equiv="Content-Style-Type" content="text/css">
8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
9<title>OSSetSwitchThreadCallback</title>
10</head>
11
12<body>
13
14<h1>OSSetSwitchThreadCallback</h1>
15
16<h2>C Specification</h2>
17
18<dl>
19  <dd><pre><code>#include &lt;revolution/os.h&gt;
20
21typedef void (*OSSwitchThreadCallback)(OSThread* <em><strong>from</strong></em>, OSThread* <em><strong>to</strong></em>);
22</code>
23<CODE>OSSwitchThreadCallback
24    OSSetSwitchThreadCallback( OSSwitchThreadCallback <em><strong>callback</strong></em> );</CODE></pre>
25  </dd>
26</dl>
27<h2>Arguments</h2>
28<TABLE border="1" cellpadding="3" cellspacing="0.1">
29  <tr>
30<TD width="120" bgcolor="#ffffe8"><code><b><i><STRONG><EM><CODE>callback</CODE></EM></STRONG></i></b></code></TD>
31<TD width="520">Callback function to call whenever a thread context switch occurs. Specify <code>NULL</code> to cancel the callback function.</TD>
32    </tr>
33  </TABLE>
34<h2>Return Values</h2>
35<P>The previous thread switch callback.</P>
36<h2>Description</h2>
37<P>Registers a specified callback function. This callback function is called whenever a thread context switch occurs. </P>
38<P><em><strong><code>callback</code></strong></em> takes two arguments. <code><em><strong>from</strong></em></code> is a pointer to the previously running thread. <code><em><strong>to</strong></em></code> is a pointer to the next running thread. If no thread is ready to run, either <code><em><strong>from</strong></em></code> or <code><em><strong>to</strong></em></code> will be <code>NULL</code>.</P>
39
40<h2>See Also</h2>
41
42<p><a href="../toc.html#Thread" target="contents">Thread Functions</a>, <a href="../toc.html#ThreadSynchronization" target="contents">Thread Synchronization Functions</a>, <a href="OSCancelThread.html"><code>OSCancelThread</code></a>,&nbsp; <a href="OSDetachThread.html"><code>OSDetachThread</code></a>,&nbsp; <code><a href="OSExitThread.html">OSExitThread</a></code>,&nbsp; <code><a href="OSIsThreadTerminated.html">OSIsThreadTerminated</a></code></p>
43<H2>Revision History</H2>
44<P>2006/03/01 Initial version.</P>
45<hr>
46<P>CONFIDENTIAL</p>
47</BODY>
48</HTML>