summaryrefslogtreecommitdiff
path: root/include/ruby
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2022-06-15 14:37:41 +0200
committerJean Boussier <jean.boussier@gmail.com>2022-06-17 09:08:26 +0200
commitb6c1e1158d71b533b255ae7a2731598455918071 (patch)
tree9b3fdf4eb4a54e56d77ec7732ff079bdd9f896bc /include/ruby
parent20d4168250fb1f534cf2db7c44998b25252a70f8 (diff)
GVL Instrumentation API: add STARTED and EXITED events
[Feature #18339] After experimenting with the initial version of the API I figured there is a need for an exit event to cleanup instrumentation data. e.g. if you record data in a {thread_id -> data} table, you need to free associated data when a thread goes away.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6029
Diffstat (limited to 'include/ruby')
-rw-r--r--include/ruby/thread.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/ruby/thread.h b/include/ruby/thread.h
index 7f9e623fe5..299aa2d62e 100644
--- a/include/ruby/thread.h
+++ b/include/ruby/thread.h
@@ -190,10 +190,12 @@ void *rb_nogvl(void *(*func)(void *), void *data1,
*/
#define RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS_
-#define RUBY_INTERNAL_THREAD_EVENT_READY 0x01 /** acquiring GVL */
-#define RUBY_INTERNAL_THREAD_EVENT_RESUMED 0x02 /** acquired GVL */
-#define RUBY_INTERNAL_THREAD_EVENT_SUSPENDED 0x04 /** released GVL */
-#define RUBY_INTERNAL_THREAD_EVENT_MASK 0x07 /** All Thread events */
+#define RUBY_INTERNAL_THREAD_EVENT_STARTED 1 << 0 /** thread started */
+#define RUBY_INTERNAL_THREAD_EVENT_READY 1 << 1 /** acquiring GVL */
+#define RUBY_INTERNAL_THREAD_EVENT_RESUMED 1 << 2 /** acquired GVL */
+#define RUBY_INTERNAL_THREAD_EVENT_SUSPENDED 1 << 3 /** released GVL */
+#define RUBY_INTERNAL_THREAD_EVENT_EXITED 1 << 4 /** thread terminated */
+#define RUBY_INTERNAL_THREAD_EVENT_MASK 0xff /** All Thread events */
typedef void rb_internal_thread_event_data_t; // for future extension.