mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
778 B
29 lines
778 B
=proto
|
|
int duk_push_thread_new_globalenv(duk_context *ctx);
|
|
|
|
=stack
|
|
[ ... ] -> [ ... thr! ]
|
|
|
|
=summary
|
|
<p>Push a new Duktape thread (context, coroutine) to the stack. Returns
|
|
non-negative index (relative to stack bottom) of the pushed thread.
|
|
The new thread will be associated with the same Duktape heap as the
|
|
argument <code>ctx</code>, but will have a new global object environment
|
|
(separate from the one used by <code>ctx</code>).</p>
|
|
|
|
<p>To interact with the new thread with the Duktape API, use
|
|
<code><a href="#duk_get_context">duk_get_context()</a></code> to get
|
|
a context pointer for API calls.</p>
|
|
|
|
=example
|
|
int thr_idx;
|
|
duk_context *new_ctx;
|
|
|
|
thr_idx = duk_push_thread_new_globalenv(ctx);
|
|
new_ctx = duk_get_context(ctx, thr_idx);
|
|
|
|
=tags
|
|
stack
|
|
|
|
=seealso
|
|
duk_push_thread
|
|
|