source: trunk/FACT++/scripts/doc/Thread.js@ 16091

Last change on this file since 16091 was 16053, checked in by tbretz, 12 years ago
Added some note...
File size: 1.8 KB
Line 
1throw new Error("Description for built in functions. Must not be included!");
2/**
3 * @fileOverview
4 * Documentation of the Thread object
5 */
6
7/**
8 * @class
9 *
10 * Creates a handle to a new thread.
11 *
12 * The handle can be used to
13 * kill the thread or be ignored. The function provided is
14 * executed after an initial timeout. Note that although this
15 * looks similar to the setTimeout in web-browsers, after started,
16 * the thread will not run until completion but run in parallel to
17 * the executed script.<P>
18 *
19 * To stop the script from within a thread, use exit(). To stop only
20 * execution of the thread (silently) throw a null exception
21 * ("throw null;"). To terminate the script with an exception
22 * throw a normal exception ("throw new Error("my error");").
23 *
24 * Note that a running thread might consume all CPU. Although it is
25 * a seperated thread, JavaScript allows only one thread to run at
26 * a time (thus it can make programming simpler, but is not really
27 * consuming more CPU). In certain circumstances, it might be necessary
28 * to give CPU time with v8.sleep(...) back to allow other threads to run.
29 *
30 * @param {Integer} timeout
31 * A positive integer given the initial delay in milliseconds before
32 * the thread is executed.
33 *
34 * @param {Function} function
35 * A function which is executed aftr the initial timeout.
36 *
37 * @throws
38 * <li> If number or type of arguments is wrong
39 *
40 * @example
41 * var handle = new Thread(100, function() { console.out("Hello world!"); });
42 * ...
43 * handle.kill();
44 */
45function Thread(timeout, function)
46{
47 /**
48 *
49 * Kills a running thread
50 *
51 * @returns {Boolean}
52 * If the thread was still known, true is returned, false
53 * otherwise. If the thread terminated already, false is
54 * returned.
55 *
56 */
57 this.kill = function() { /* [native code] */ }
58};
Note: See TracBrowser for help on using the repository browser.