From 8884ad01f5188b1297ddd7eba0f4a0ff9795ab56 Mon Sep 17 00:00:00 2001 From: PePerRoNii Date: Wed, 20 Aug 2025 21:00:25 +0700 Subject: [PATCH] added name argument description --- core/thread/thread.odin | 42 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/core/thread/thread.odin b/core/thread/thread.odin index c0174636a..53f9b3f62 100644 --- a/core/thread/thread.odin +++ b/core/thread/thread.odin @@ -104,7 +104,11 @@ thread will be in a suspended state, until `start()` procedure is called. 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 63 bytes on Windows. */ + create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal, name: Maybe(string) = nil) -> ^Thread { return _create(procedure, priority, name) } @@ -178,6 +182,9 @@ This procedure runs the given procedure on another thread. The context 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 63 bytes on Windows. + **IMPORTANT**: If `init_context` is specified and the default temporary allocator is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()` in order to free the resources associated with the temporary allocations. @@ -193,6 +200,9 @@ This procedure runs the given procedure on another thread. The context 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 63 bytes on Windows. + **IMPORTANT**: If `init_context` is specified and the default temporary allocator is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()` in order to free the resources associated with the temporary allocations. @@ -208,6 +218,9 @@ This procedure runs the given procedure on another thread. The context 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 63 bytes on Windows. + **IMPORTANT**: If `init_context` is specified and the default temporary allocator is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()` in order to free the resources associated with the temporary allocations. @@ -224,6 +237,9 @@ This procedure runs the given procedure on another thread. The context 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 63 bytes on Windows. + **IMPORTANT**: If `init_context` is specified and the default temporary allocator is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()` in order to free the resources associated with the temporary allocations. @@ -240,6 +256,9 @@ This procedure runs the given procedure on another thread. The context 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 63 bytes on Windows. + **IMPORTANT**: If `init_context` is specified and the default temporary allocator is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()` in order to free the resources associated with the temporary allocations. @@ -256,6 +275,9 @@ This procedure runs the given procedure on another thread. The context 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 63 bytes on Windows. + **IMPORTANT**: If `init_context` is specified and the default temporary allocator is used, the thread procedure needs to call `runtime.default_temp_allocator_destroy()` in order to free the resources associated with the temporary allocations. @@ -276,6 +298,9 @@ If `self_cleanup` is specified, after the thread finishes the execution of the `fn` procedure, the resources associated with the thread are going to be automatically freed. +Optionally specify the thread's name/description. +the name/description will be truncated to 15 bytes on Unix and 63 bytes on Windows. + **Do not** dereference the `^Thread` pointer, if this flag is specified. That includes calling `join`, which needs to dereference ^Thread`. @@ -311,6 +336,9 @@ If `self_cleanup` is specified, after the thread finishes the execution of the `fn` procedure, the resources associated with the thread are going to be automatically freed. +Optionally specify the thread's name/description. +the name/description will be truncated to 15 bytes on Unix and 63 bytes on Windows. + **Do not** dereference the `^Thread` pointer, if this flag is specified. That includes calling `join`, which needs to dereference ^Thread`. @@ -350,6 +378,9 @@ If `self_cleanup` is specified, after the thread finishes the execution of the `fn` procedure, the resources associated with the thread are going to be automatically freed. +Optionally specify the thread's name/description. +the name/description will be truncated to 15 bytes on Unix and 63 bytes on Windows. + **Do not** dereference the `^Thread` pointer, if this flag is specified. That includes calling `join`, which needs to dereference ^Thread`. @@ -395,6 +426,9 @@ If `self_cleanup` is specified, after the thread finishes the execution of the `fn` procedure, the resources associated with the thread are going to be automatically freed. +Optionally specify the thread's name/description. +the name/description will be truncated to 15 bytes on Unix and 63 bytes on Windows. + **Do not** dereference the `^Thread` pointer, if this flag is specified. That includes calling `join`, which needs to dereference ^Thread`. @@ -446,6 +480,9 @@ If `self_cleanup` is specified, after the thread finishes the execution of the `fn` procedure, the resources associated with the thread are going to be automatically freed. +Optionally specify the thread's name/description. +the name/description will be truncated to 15 bytes on Unix and 63 bytes on Windows. + **Do not** dereference the `^Thread` pointer, if this flag is specified. That includes calling `join`, which needs to dereference ^Thread`. @@ -499,6 +536,9 @@ If `self_cleanup` is specified, after the thread finishes the execution of the `fn` procedure, the resources associated with the thread are going to be automatically freed. +Optionally specify the thread's name/description. +the name/description will be truncated to 15 bytes on Unix and 63 bytes on Windows. + **Do not** dereference the `^Thread` pointer, if this flag is specified. That includes calling `join`, which needs to dereference ^Thread`. @@ -572,4 +612,4 @@ _maybe_destroy_default_temp_allocator :: proc(init_context: Maybe(runtime.Contex if context.temp_allocator.procedure == runtime.default_temp_allocator_proc { runtime.default_temp_allocator_destroy(auto_cast context.temp_allocator.data) } -} \ No newline at end of file +}