Deploy to GitHub Pages:

This commit is contained in:
Travis CI
2021-02-06 15:58:10 +00:00
parent a56214433f
commit 30ea6fa8b4
7 changed files with 105 additions and 11 deletions

View File

@ -60,9 +60,26 @@
</nav>
<main>
<h1>Scheduler Class</h1>
<p><strong>TODO</strong></p>
<h2>Methods <a href="#methods" name="methods" class="header-anchor">#</a></h2>
<p><strong>TODO</strong></p>
<p>The Scheduler class maintains a list of fibers, to be started one after the other, when a signal to do so is received. The signal (a private method call) is typically transmitted by <em>long running</em> methods in the File or Timer classes which suspend the current fiber so that Wren can carry out other tasks in the meantime.</p>
<h2>Static Method <a href="#static-method" name="static-method" class="header-anchor">#</a></h2>
<h3>Scheduler.<strong>add</strong>(callable) <a href="#scheduler.add(callable)" name="scheduler.add(callable)" class="header-anchor">#</a></h3>
<p>Adds a new fiber to the scheduler&rsquo;s fibers list. This fiber calls <code>callable</code> and then transfers to the next fiber in the list, if there is one.</p>
<p><code>callable</code> is a function or other object which has a call() method.</p>
<pre class="snippet">
var a = 3
Scheduler.add {
a = a * a
}
Scheduler.add {
a = a + 1
}
System.print(a) // still 3
Timer.sleep(3000) // wait 3 seconds
System.print(a) // now 3 * 3 + 1 = 10
</pre>
</main>
</div>
<footer>

View File

@ -60,9 +60,11 @@
</nav>
<main>
<h1>Timer Class</h1>
<p><strong>TODO</strong></p>
<h2>Methods <a href="#methods" name="methods" class="header-anchor">#</a></h2>
<p><strong>TODO</strong></p>
<h2>Static Method <a href="#static-method" name="static-method" class="header-anchor">#</a></h2>
<h3>Timer.<strong>sleep</strong>(milliseconds) <a href="#timer.sleep(milliseconds)" name="timer.sleep(milliseconds)" class="header-anchor">#</a></h3>
<p>Suspends the current fiber for the given number of milliseconds. It is a runtime error if this is not a non-negative number.</p>
<p>This method is often used in conjunction with the Scheduler class which runs any scheduled tasks in separate fibers whilst the current fiber is sleeping.</p>
<p>Note that this method also suspends the System.clock method which will not give the correct running time for a program as a result.</p>
</main>
</div>
<footer>