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
841 B

name: duk_push_thread
proto: |
duk_idx_t duk_push_thread(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>, and will share the same global object
environment.</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(ctx);
new_ctx = duk_get_context(ctx, thr_idx);
tags:
- stack
- thread
- borrowed
seealso:
- duk_push_thread_new_globalenv
introduced: 1.0.0