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_DisableScheduler</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">OS_DisableScheduler <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 <nitro/os.h></CODE></PRE> 16 <PRE><CODE>u32 OS_DisableScheduler( void );</CODE></PRE> 17</DL> 18<H2>Arguments</H2> 19<P>None.</P> 20 21<H2>Return Values</H2> 22<P>The internal counter value after canceling the suppression of the scheduler operation.</P> 23<P>When this value is larger than 0, the scheduler operation is suppressed. (It is suppressed, since a value greater than 0 is always returned.))</P> 24 25<H2>Description</H2> 26<P> Suppresses the operation of the thread system scheduler. In other words, this stops rescheduling temporarily.</P> 27<P>Even when the functions such as <code><a href="OS_WakeupThread.html">OS_WakeupThread</a></code> and <code><a href="OS_SetThreadPriority.html">OS_SetThreadPriority</a></code> that have the possibility of generating the rescheduling of thread are called, this prevents the rescheduling of thread.</P> 28<P>The function that cancels the suppression of the scheduler operation of <code>OS_DisableScheduler</code> is <code><a href="OS_EnableScheduler.html">OS_EnableScheduler</a></code>. Normally, these two functions should be used as a pair.</P> 29<P> Call <code>OS_DisableScheduler</code> and <code><a href="OS_EnableScheduler.html">OS_EnableScheduler</a></code> while the interrupts are prohibited.</P> 30<P> The scheduler has the internal counter. That counter, which is normally set to 0, increments by one with <code>OS_DisableScheduler</code> and decrements by one with <code><a href="OS_EnableScheduler.html">OS_EnableScheduler</a></code>. In addition, if it is larger than 0, this prevents rescheduling. The return value from this function is the value after the counter has changed. Therefore, after calling this function, the value that is larger than 0 is always returned.</P> 31<P> A set of <code>OS_DisableScheduler</code> and <code><a href="OS_EnableScheduler.html">OS_EnableScheduler</a></code> as a pair can be nested.</P> 32<BLOCKQUOTE>Example:<br /> 33<PRE> : 34(void)OS_DisableRescheduler(); 35 : // Rescheduling prohibited 36(void)OS_DisableRescheduler(); 37 : 38(void)OS_EnableRescheduler(); 39 : // Rescheduling still prohibited 40(void)OS_EnableRescheduler(); 41 : // Rescheduling is allowed</PRE></BLOCKQUOTE> 42 43<P><B>Caution:</B> Depending on the situation, the program may stop because there is no thread to operate. For example, if <code>OS_DisableScheduler</code> was set to prevent rescheduling and <code><a href="OS_ExitThread.html">OS_ExitThread</a></code> was called, the execution right cannot be given to other threads even after completing the current thread. It requires special attention to avoid such a situation.</P> 44<H2>See Also</H2> 45<P><code><a href="OS_SelectThread.html">OS_SelectThread</a>, <a href="OS_RescheduleThread.html">OS_RescheduleThread</a>, <a href="OS_EnableScheduler.html">OS_EnableScheduler</a></code></P> 46<H2>Revision History</H2> 47<P> 482005/03/08 Standardized the Japanese term for "interrupt."<BR> 492005/01/21 Initial version.</P> 50<hr><p>CONFIDENTIAL</p></body> 51</HTML>