|
|
|
|
@@ -53,6 +53,7 @@ Thread :: struct {
|
|
|
|
|
// it is started.
|
|
|
|
|
data: rawptr,
|
|
|
|
|
// Thread's Name/Description that will get set during thread creation
|
|
|
|
|
// it will be set using init_context's allocator to allocate and free a cstring buffer
|
|
|
|
|
// for thread's creation only : do not refer to it, use thread.get_name instead
|
|
|
|
|
name: Maybe(string),
|
|
|
|
|
// User-supplied integer, that will be available to the thread once it is
|
|
|
|
|
@@ -110,7 +111,7 @@ To start the thread, call `start()`. Also the `create_and_start()`
|
|
|
|
|
procedure can be called to create and start the thread immediately.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal, name: Maybe(string) = nil) -> ^Thread {
|
|
|
|
|
@@ -188,7 +189,7 @@ specified by `init_context` will be used as the context in which `fn` is going
|
|
|
|
|
to execute. The thread will have priority specified by the `priority` parameter.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**IMPORTANT**: If `init_context` is specified and the default temporary allocator
|
|
|
|
|
is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()`
|
|
|
|
|
@@ -206,7 +207,7 @@ specified by `init_context` will be used as the context in which `fn` is going
|
|
|
|
|
to execute. The thread will have priority specified by the `priority` parameter.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**IMPORTANT**: If `init_context` is specified and the default temporary allocator
|
|
|
|
|
is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()`
|
|
|
|
|
@@ -224,7 +225,7 @@ specified by `init_context` will be used as the context in which `fn` is going
|
|
|
|
|
to execute. The thread will have priority specified by the `priority` parameter.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**IMPORTANT**: If `init_context` is specified and the default temporary allocator
|
|
|
|
|
is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()`
|
|
|
|
|
@@ -243,7 +244,7 @@ specified by `init_context` will be used as the context in which `fn` is going
|
|
|
|
|
to execute. The thread will have priority specified by the `priority` parameter.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**IMPORTANT**: If `init_context` is specified and the default temporary allocator
|
|
|
|
|
is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()`
|
|
|
|
|
@@ -262,7 +263,7 @@ specified by `init_context` will be used as the context in which `fn` is going
|
|
|
|
|
to execute. The thread will have priority specified by the `priority` parameter.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**IMPORTANT**: If `init_context` is specified and the default temporary allocator
|
|
|
|
|
is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()`
|
|
|
|
|
@@ -281,7 +282,7 @@ specified by `init_context` will be used as the context in which `fn` is going
|
|
|
|
|
to execute. The thread will have priority specified by the `priority` parameter.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**IMPORTANT**: If `init_context` is specified and the default temporary allocator
|
|
|
|
|
is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()`
|
|
|
|
|
@@ -304,7 +305,7 @@ If `self_cleanup` is specified, after the thread finishes the execution of the
|
|
|
|
|
automatically freed.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**Do not** dereference the `^Thread` pointer, if this flag is specified.
|
|
|
|
|
That includes calling `join`, which needs to dereference ^Thread`.
|
|
|
|
|
@@ -342,7 +343,7 @@ If `self_cleanup` is specified, after the thread finishes the execution of the
|
|
|
|
|
automatically freed.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**Do not** dereference the `^Thread` pointer, if this flag is specified.
|
|
|
|
|
That includes calling `join`, which needs to dereference ^Thread`.
|
|
|
|
|
@@ -384,7 +385,7 @@ If `self_cleanup` is specified, after the thread finishes the execution of the
|
|
|
|
|
automatically freed.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**Do not** dereference the `^Thread` pointer, if this flag is specified.
|
|
|
|
|
That includes calling `join`, which needs to dereference ^Thread`.
|
|
|
|
|
@@ -432,7 +433,7 @@ If `self_cleanup` is specified, after the thread finishes the execution of the
|
|
|
|
|
automatically freed.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**Do not** dereference the `^Thread` pointer, if this flag is specified.
|
|
|
|
|
That includes calling `join`, which needs to dereference ^Thread`.
|
|
|
|
|
@@ -486,7 +487,7 @@ If `self_cleanup` is specified, after the thread finishes the execution of the
|
|
|
|
|
automatically freed.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**Do not** dereference the `^Thread` pointer, if this flag is specified.
|
|
|
|
|
That includes calling `join`, which needs to dereference ^Thread`.
|
|
|
|
|
@@ -542,7 +543,7 @@ If `self_cleanup` is specified, after the thread finishes the execution of the
|
|
|
|
|
automatically freed.
|
|
|
|
|
|
|
|
|
|
Optionally specify the thread's name/description.
|
|
|
|
|
the name/description will be truncated to 15 bytes on Unix and 127 bytes on Windows.
|
|
|
|
|
the name/description will be truncated to fit the OS's limit.
|
|
|
|
|
|
|
|
|
|
**Do not** dereference the `^Thread` pointer, if this flag is specified.
|
|
|
|
|
That includes calling `join`, which needs to dereference ^Thread`.
|
|
|
|
|
|