1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" /> 7 <style type="text/css"><!-- 8 span.static_style 9 { 10 font-size : 8pt; 11 color : white; 12 font-weight : bold; 13 background : #44f; 14 border-left : solid 1px #aaf; 15 border-top : solid 1px #aaf; 16 border-right : solid 1px #00c; 17 border-bottom : solid 1px #00c; 18 padding-left : 2px; 19 padding-right : 2px; 20 } 21 span.virtual_style 22 { 23 font-size : 8pt; 24 color : white; 25 font-weight : bold; 26 background : #0a0; 27 border-left : solid 1px #0f0; 28 border-top : solid 1px #0f0; 29 border-right : solid 1px #060; 30 border-bottom : solid 1px #060; 31 padding-left : 2px; 32 padding-right : 2px; 33 } 34 span.protected_style 35 { 36 font-size : 8pt; 37 color : white; 38 font-weight : bold; 39 background : #444; 40 border-left : solid 1px #ccc; 41 border-top : solid 1px #ccc; 42 border-right : solid 1px #222; 43 border-bottom : solid 1px #222; 44 padding-left : 2px; 45 padding-right : 2px; 46 } 47 --></style> 48<title>nn::os::Alarm</title> 49 </head> 50 <body> 51<h1><CODE><a href="../../../nn/Overview.html">nn</a>::<a href="../../../nn/os/Overview.html">os</a>::Alarm</CODE> Class</h1> 52 <div class="section"> 53<b>Header file: </b>nn/os.h</div> 54<h2>Syntax</h2> 55 <div class="section"> 56<pre class="definition">class Alarm :<br /> private nn::os::QueueableWaitTask,<br /> private <a href="../../../nn/util/NonCopyable/Overview.html">nn::util::NonCopyable< Alarm ></a></pre> 57 </div> 58<h2>Description</h2> 59 <div class="section"> 60<p>Class for handling alarms.</p><p>Alarms use the timer functionality of the OS to call a handler after the specified time has elapsed. When the handler is called, its first argument is the argument that was used when the alarm was set, and its second argument is <CODE>false</CODE>.</p><p>(This content of this paragraph may be changed in the future. ) To use this class you must first call <CODE><a href="../../../nn/os/InitializeAlarmSystem.html">nn::os::InitializeAlarmSystem</a></CODE>. Alarm handlers are run in certain specific threads, and in the current implementation the number of these threads is limited to two. As a result, the alarm system will become unstable if you register many handlers that take a long time to complete (for example, those that perform thread blocking).</p><p>There are two types of alarms: one-shot alarms and periodic alarms.</p><p>One-shot alarms are set using <CODE><a href="../../../nn/os/Alarm/SetOneShot.html">SetOneShot</a></CODE> and cause a handler to be called after a fixed period of time. After calling either of these functions once, it is not possible to call <CODE><a href="../../../nn/os/Alarm/SetOneShot.html">SetOneShot</a></CODE> or <CODE><a href="../../../nn/os/Alarm/SetPeriodic.html">SetPeriodic</a></CODE> again until the handler starts. These setter functions can be called again within the handler.</p><p>Periodic alarms are set using <CODE><a href="../../../nn/os/Alarm/SetPeriodic.html">SetPeriodic</a></CODE> and cause a handler to be called periodically thereafter. It is not possible to call either <CODE><a href="../../../nn/os/Alarm/SetOneShot.html">SetOneShot</a></CODE> or <CODE><a href="../../../nn/os/Alarm/SetPeriodic.html">SetPeriodic</a></CODE> again while a periodic alarm is active.</p><p>You can cancel an alarm before the handler has run by calling <CODE><a href="../../../nn/os/Alarm/Cancel.html">Cancel</a></CODE>. If the handler has already started, the handler will not be cancelled even if you call <CODE><a href="../../../nn/os/Alarm/Cancel.html">Cancel</a></CODE>. If <CODE><a href="../../../nn/os/Alarm/Cancel.html">Cancel</a></CODE> is called while an alarm is set (before a periodic alarm or one-shot alarm calls the handler), the alarm handler is called with its second argument set to <CODE>true</CODE>.</p><!-- write here --></div> 61 <a name="function" id="function"> 62<h2>Member Functions</h2> 63 <div class="section"> 64 <table class="members"> 65 <tr> 66 <td width="100"> </td> 67 <th> 68<a href="../../../nn/os/Alarm/Alarm.html"><CODE>Alarm</CODE></a> 69 </th> 70<td>Constructs an object. No initialization is performed. Before using the object, you must initialize it explicitly by calling <a href="../../../nn/os/Alarm/Initialize.html"><CODE>Initialize</CODE></a>.</td> 71 </tr> 72 <tr> 73<td width="100"> <span class="virtual_style" title="virtual">V</span> 74 </td> 75 <th> 76<a href="../../../nn/os/Alarm/~Alarm.html"><CODE>~Alarm</CODE></a> 77 </th> 78<td>Destroys an object. Calls <a href="../../../nn/os/Alarm/Finalize.html"><CODE>Finalize</CODE></a>. This function cannot be called when an alarm is currently set.</td> 79 </tr> 80 <tr> 81 <td width="100"> </td> 82 <th> 83<a href="../../../nn/os/Alarm/TryInitialize.html"><CODE>TryInitialize</CODE></a> 84 </th> 85<td>Tries to initialize an alarm object.</td> 86 </tr> 87 <tr> 88 <td width="100"> </td> 89 <th> 90<a href="../../../nn/os/Alarm/Initialize.html"><CODE>Initialize</CODE></a> 91 </th> 92<td>Initializes an alarm object.</td> 93 </tr> 94 <tr> 95 <td width="100"> </td> 96 <th> 97<a href="../../../nn/os/Alarm/Finalize.html"><CODE>Finalize</CODE></a> 98 </th> 99<td>Finalizes an alarm. This function cannot be called when an alarm is currently set.</td> 100 </tr> 101 <tr> 102 <td width="100"> </td> 103 <th> 104<a href="../../../nn/os/Alarm/SetOneShot.html"><CODE>SetOneShot</CODE></a> 105 </th> 106<td>Sets a one-shot alarm. Calls the handler only once after the specified <SPAN class="argument">time</SPAN> has elapsed.</td> 107 </tr> 108 <tr> 109 <td width="100"> </td> 110 <th> 111<a href="../../../nn/os/Alarm/SetPeriodic.html"><CODE>SetPeriodic</CODE></a> 112 </th> 113<td>Sets a periodic alarm. Calls the handler once after the <SPAN class="argument">initial</SPAN> duration has elapsed and thereafter continues calling it at the specified <SPAN class="argument">interval</SPAN>.</td> 114 </tr> 115 <tr> 116 <td width="100"> </td> 117 <th> 118<a href="../../../nn/os/Alarm/Cancel.html"><CODE>Cancel</CODE></a> 119 </th> 120<td>Cancels an alarm that has been set.</td> 121 </tr> 122 <tr> 123 <td width="100"> </td> 124 <th> 125<a href="../../../nn/os/Alarm/CanSet.html"><CODE>CanSet</CODE></a> 126 </th> 127<td>Determines whether the current state allows alarms to be set.</td> 128 </tr> </table> 129 </div> 130 </a> 131<h2>Class Hierarchy</h2> 132 <div class="section"> 133<p class="hierarchy"><a href="../../../nn/util/NonCopyable/Overview.html">nn::util::NonCopyable</a><br /> <a href="../../../nn/fnd/IntrusiveQueue/Overview.html">nn::fnd::IntrusiveQueue</a><br /> <span>nn::os::QueueableTask</span><br /> <span>nn::os::QueueableWaitTask</span><br /> <b>nn::os::Alarm</b> 134 </p> 135 </div> 136<h2>Revision History</h2> 137 <div class="section"> 138 <dl class="history"> 139 <dt>2010/01/07</dt> 140<dd>Initial version.<br /> 141 </dd> 142 </dl> 143 </div> 144 <hr><p>CONFIDENTIAL</p></body> 145</html> 146