summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authorKoichi Sasada <[email protected]>2023-11-17 02:29:11 +0900
committerKoichi Sasada <[email protected]>2023-12-08 13:16:19 +0900
commit352a885a0f1a4d4576c686301ee71ea887a345e5 (patch)
treeafb66f30ac5e3056d3cf3b96ca71d5c78b4f77a0 /vm_core.h
parent9b7a964318d04beb82680ff1d0c6eb571f4b8b5e (diff)
Thread specific storage APIs
This patch introduces thread specific storage APIs for tools which use `rb_internal_thread_event_hook` APIs. * `rb_internal_thread_specific_key_create()` to create a tool specific thread local storage key and allocate the storage if not available. * `rb_internal_thread_specific_set()` sets a data to thread and tool specific storage. * `rb_internal_thread_specific_get()` gets a data in thread and tool specific storage. Note that `rb_internal_thread_specific_get|set(thread_val, key)` can be called without GVL and safe for async signal and safe for multi-threading (native threads). So you can call it in any internal thread event hooks. Further more you can call it from other native threads. Of course `thread_val` should be living while accessing the data from this function. Note that you should not forget to clean up the set data.
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/vm_core.h b/vm_core.h
index fcac71b2e5..cd720fd8cf 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1152,6 +1152,7 @@ typedef struct rb_thread_struct {
/* misc */
VALUE name;
+ void **specific_storage;
struct rb_ext_config ext_config;
} rb_thread_t;