summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJean Boussier <byroot@ruby-lang.org>2023-11-24 13:18:00 +0100
committerJean Boussier <jean.boussier@gmail.com>2023-11-27 17:37:57 +0100
commit23a7714343b372234972ef0dacf774d07fe65ced (patch)
tree9b507cf583a37cece7cffb066e4c71ef6972161e /include
parente3875dd0f8f11d9dbdc25b400f387c406b799cb5 (diff)
Refactor and fix the GVL instrumentation API
This entirely changes how it is tested. Rather than to use counters we now record the timeline of events with associated threads which makes it much easier to assert that certains events are only preceded by a specific event, and makes it much easier to debug unexpected timelines. Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com> Co-Authored-By: JP Camara <jp@jpcamara.com> Co-Authored-By: John Hawthorn <john@hawthorn.email>
Diffstat (limited to 'include')
-rw-r--r--include/ruby/thread.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/ruby/thread.h b/include/ruby/thread.h
index f6eea65b70..f11cc19086 100644
--- a/include/ruby/thread.h
+++ b/include/ruby/thread.h
@@ -243,9 +243,12 @@ typedef struct rb_internal_thread_event_hook rb_internal_thread_event_hook_t;
* @param[in] events A set of events that `func` should run.
* @param[in] data Passed as-is to `func`.
* @return An opaque pointer to the hook, to unregister it later.
- * @note This functionality is a noop on Windows.
+ * @note This functionality is a noop on Windows and WebAssembly.
* @note The callback will be called without the GVL held, except for the
* RESUMED event.
+ * @note Callbacks are not guaranteed to be executed on the native threads
+ * that corresponds to the Ruby thread. To identify which Ruby thread
+ * the event refers to, you must use `event_data->thread`.
* @warning This function MUST not be called from a thread event callback.
*/
rb_internal_thread_event_hook_t *rb_internal_thread_add_event_hook(
@@ -258,7 +261,7 @@ rb_internal_thread_event_hook_t *rb_internal_thread_add_event_hook(
*
* @param[in] hook. The hook to unregister.
* @return Wether the hook was found and unregistered.
- * @note This functionality is a noop on Windows.
+ * @note This functionality is a noop on Windows and WebAssembly.
* @warning This function MUST not be called from a thread event callback.
*/
bool rb_internal_thread_remove_event_hook(