1 | /**
|
---|
2 | * @fileOverview
|
---|
3 | * Documentation of the Thread object
|
---|
4 | */
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * @class
|
---|
8 | *
|
---|
9 | * Creates a handle to a new thread.
|
---|
10 | *
|
---|
11 | * The handle can be used to
|
---|
12 | * kill the thread or be ignored. The function provided is
|
---|
13 | * executed after an initial timeout. Note that although this
|
---|
14 | * looks similar to the setTimeout in web-browsers, after started,
|
---|
15 | * the thread will not run until completion but run in parallel to
|
---|
16 | * the executed script.<P>
|
---|
17 | *
|
---|
18 | * To stop the script from within a thread, use exit(). To stop only
|
---|
19 | * execution of the thread (silently) throw a null exception
|
---|
20 | * ("throw null;"). To terminate the script with an exception
|
---|
21 | * throw a normal exception ("throw new Error("my error");").
|
---|
22 | *
|
---|
23 | * @param {Integer} timeout
|
---|
24 | * A positive integer given the initial delay in milliseconds before
|
---|
25 | * the thread is executed.
|
---|
26 | *
|
---|
27 | * @param {Function} function
|
---|
28 | * A function which is executed aftr the initial timeout.
|
---|
29 | *
|
---|
30 | * @throws
|
---|
31 | * <li> If number or type of arguments is wrong
|
---|
32 | *
|
---|
33 | * @example
|
---|
34 | * var handle = new Thread(100, function() { dim.out("Hello world!"); });
|
---|
35 | * handle.kill();
|
---|
36 | */
|
---|
37 | function Thread(timeout, function)
|
---|
38 | {
|
---|
39 | /**
|
---|
40 | *
|
---|
41 | * Kills a running thread
|
---|
42 | *
|
---|
43 | * @returns {Boolean}
|
---|
44 | * If the thread was still known, true is returned, false
|
---|
45 | * otherwise. If the thread terminated already, false is
|
---|
46 | * returned.
|
---|
47 | *
|
---|
48 | */
|
---|
49 | this.kill = function() { /* [native code] */ }
|
---|
50 | };
|
---|