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.
35 lines
914 B
35 lines
914 B
name: duk_push_thread_new_globalenv
|
|
|
|
proto: |
|
|
duk_idx_t 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: |
|
|
duk_idx_t thr_idx;
|
|
duk_context *new_ctx;
|
|
|
|
thr_idx = duk_push_thread_new_globalenv(ctx);
|
|
new_ctx = duk_get_context(ctx, thr_idx);
|
|
|
|
tags:
|
|
- stack
|
|
- thread
|
|
- borrowed
|
|
|
|
seealso:
|
|
- duk_push_thread
|
|
|
|
introduced: 1.0.0
|
|
|