Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / scheduler-objects.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="prev" href="module-sched.html" />
13<link rel="parent" href="module-sched.html" />
14<link rel="next" href="module-mutex.html" />
15<meta name='aesop' content='information' />
16<title>6.12.1 Scheduler Objects </title>
17</head>
18<body>
19<DIV CLASS="navigation">
20<div id='top-navigation-panel' xml:id='top-navigation-panel'>
21<table align="center" width="100%" cellpadding="0" cellspacing="2">
22<tr>
23<td class='online-navigation'><a rel="prev" title="6.12 sched "
24 href="module-sched.html"><img src='../icons/previous.png'
25 border='0' height='32' alt='Previous Page' width='32' /></A></td>
26<td class='online-navigation'><a rel="parent" title="6.12 sched "
27 href="module-sched.html"><img src='../icons/up.png'
28 border='0' height='32' alt='Up One Level' width='32' /></A></td>
29<td class='online-navigation'><a rel="next" title="6.13 mutex "
30 href="module-mutex.html"><img src='../icons/next.png'
31 border='0' height='32' alt='Next Page' width='32' /></A></td>
32<td align="center" width="100%">Python Library Reference</td>
33<td class='online-navigation'><a rel="contents" title="Table of Contents"
34 href="contents.html"><img src='../icons/contents.png'
35 border='0' height='32' alt='Contents' width='32' /></A></td>
36<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
37 border='0' height='32' alt='Module Index' width='32' /></a></td>
38<td class='online-navigation'><a rel="index" title="Index"
39 href="genindex.html"><img src='../icons/index.png'
40 border='0' height='32' alt='Index' width='32' /></A></td>
41</tr></table>
42<div class='online-navigation'>
43<b class="navlabel">Previous:</b>
44<a class="sectref" rel="prev" href="module-sched.html">6.12 sched </A>
45<b class="navlabel">Up:</b>
46<a class="sectref" rel="parent" href="module-sched.html">6.12 sched </A>
47<b class="navlabel">Next:</b>
48<a class="sectref" rel="next" href="module-mutex.html">6.13 mutex </A>
49</div>
50<hr /></div>
51</DIV>
52<!--End of Navigation Panel-->
53
54<H2><A NAME="SECTION0081210000000000000000"></A><A NAME="scheduler-objects"></A>
55<BR>
566.12.1 Scheduler Objects
57</H2>
58
59<P>
60<tt class="class">scheduler</tt> instances have the following methods:
61
62<P>
63<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
64 <td><nobr><b><tt id='l2h-1982' xml:id='l2h-1982' class="method">enterabs</tt></b>(</nobr></td>
65 <td><var>time, priority, action, argument</var>)</td></tr></table></dt>
66<dd>
67Schedule a new event. The <var>time</var> argument should be a numeric type
68compatible with the return value of the <var>timefunc</var> function passed
69to the constructor. Events scheduled for
70the same <var>time</var> will be executed in the order of their
71<var>priority</var>.
72
73<P>
74Executing the event means executing
75<code><var>action</var>(*<var>argument</var>)</code>. <var>argument</var> must be a
76sequence holding the parameters for <var>action</var>.
77
78<P>
79Return value is an event which may be used for later cancellation of
80the event (see <tt class="method">cancel()</tt>).
81</dl>
82
83<P>
84<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
85 <td><nobr><b><tt id='l2h-1983' xml:id='l2h-1983' class="method">enter</tt></b>(</nobr></td>
86 <td><var>delay, priority, action, argument</var>)</td></tr></table></dt>
87<dd>
88Schedule an event for <var>delay</var> more time units. Other then the
89relative time, the other arguments, the effect and the return value
90are the same as those for <tt class="method">enterabs()</tt>.
91</dl>
92
93<P>
94<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
95 <td><nobr><b><tt id='l2h-1984' xml:id='l2h-1984' class="method">cancel</tt></b>(</nobr></td>
96 <td><var>event</var>)</td></tr></table></dt>
97<dd>
98Remove the event from the queue. If <var>event</var> is not an event
99currently in the queue, this method will raise a
100<tt class="exception">RuntimeError</tt>.
101</dl>
102
103<P>
104<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
105 <td><nobr><b><tt id='l2h-1985' xml:id='l2h-1985' class="method">empty</tt></b>(</nobr></td>
106 <td><var></var>)</td></tr></table></dt>
107<dd>
108Return true if the event queue is empty.
109</dl>
110
111<P>
112<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
113 <td><nobr><b><tt id='l2h-1986' xml:id='l2h-1986' class="method">run</tt></b>(</nobr></td>
114 <td><var></var>)</td></tr></table></dt>
115<dd>
116Run all scheduled events. This function will wait
117(using the <tt class="function">delayfunc</tt> function passed to the constructor)
118for the next event, then execute it and so on until there are no more
119scheduled events.
120
121<P>
122Either <var>action</var> or <var>delayfunc</var> can raise an exception. In
123either case, the scheduler will maintain a consistent state and
124propagate the exception. If an exception is raised by <var>action</var>,
125the event will not be attempted in future calls to <tt class="method">run()</tt>.
126
127<P>
128If a sequence of events takes longer to run than the time available
129before the next event, the scheduler will simply fall behind. No
130events will be dropped; the calling code is responsible for canceling
131events which are no longer pertinent.
132</dl>
133
134<DIV CLASS="navigation">
135<div class='online-navigation'>
136<p></p><hr />
137<table align="center" width="100%" cellpadding="0" cellspacing="2">
138<tr>
139<td class='online-navigation'><a rel="prev" title="6.12 sched "
140 href="module-sched.html"><img src='../icons/previous.png'
141 border='0' height='32' alt='Previous Page' width='32' /></A></td>
142<td class='online-navigation'><a rel="parent" title="6.12 sched "
143 href="module-sched.html"><img src='../icons/up.png'
144 border='0' height='32' alt='Up One Level' width='32' /></A></td>
145<td class='online-navigation'><a rel="next" title="6.13 mutex "
146 href="module-mutex.html"><img src='../icons/next.png'
147 border='0' height='32' alt='Next Page' width='32' /></A></td>
148<td align="center" width="100%">Python Library Reference</td>
149<td class='online-navigation'><a rel="contents" title="Table of Contents"
150 href="contents.html"><img src='../icons/contents.png'
151 border='0' height='32' alt='Contents' width='32' /></A></td>
152<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
153 border='0' height='32' alt='Module Index' width='32' /></a></td>
154<td class='online-navigation'><a rel="index" title="Index"
155 href="genindex.html"><img src='../icons/index.png'
156 border='0' height='32' alt='Index' width='32' /></A></td>
157</tr></table>
158<div class='online-navigation'>
159<b class="navlabel">Previous:</b>
160<a class="sectref" rel="prev" href="module-sched.html">6.12 sched </A>
161<b class="navlabel">Up:</b>
162<a class="sectref" rel="parent" href="module-sched.html">6.12 sched </A>
163<b class="navlabel">Next:</b>
164<a class="sectref" rel="next" href="module-mutex.html">6.13 mutex </A>
165</div>
166</div>
167<hr />
168<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
169</DIV>
170<!--End of Navigation Panel-->
171<ADDRESS>
172See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
173</ADDRESS>
174</BODY>
175</HTML>