source: branches/fscctrl_safety_limits/scripts/doc/Thread.js@ 18733

Last change on this file since 18733 was 16102, checked in by tbretz, 12 years ago
Added a user supplied 'this' argument to v8.timeout and the Thread class.
File size: 2.0 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 * @param {Object} [_this]
38 * An object which will be the reference for 'this' in the function call.
39 * If none is given, the function itself will be the 'this' object.
40 *
41 * @throws
42 * <li> If number or type of arguments is wrong
43 *
44 * @example
45 * var handle = new Thread(100, function() { console.out("Hello world!"); });
46 * ...
47 * handle.kill();
48 */
49function Thread(timeout, function, _this)
50{
51 /**
52 *
53 * Kills a running thread
54 *
55 * @returns {Boolean}
56 * If the thread was still known, true is returned, false
57 * otherwise. If the thread terminated already, false is
58 * returned.
59 *
60 */
61 this.kill = function() { /* [native code] */ }
62};
Note: See TracBrowser for help on using the repository browser.