1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/include/ruby
Jean Boussier 9125374726 [Feature #18339] GVL Instrumentation API
Ref: https://bugs.ruby-lang.org/issues/18339

Design:

- This tries to minimize the overhead when no hook is registered.
  It should only incur an extra unsynchronized boolean check.
- The hook list is protected with a read-write lock as to cause
  contention when some hooks are registered.
- The hooks MUST be thread safe, and MUST NOT call into Ruby as they
  are executed outside the GVL.
- It's simply a noop on Windows.

API:

```
rb_internal_thread_event_hook_t * rb_internal_thread_add_event_hook(rb_internal_thread_event_callback callback, rb_event_flag_t internal_event, void *user_data);
bool rb_internal_thread_remove_event_hook(rb_internal_thread_event_hook_t * hook);
```

You can subscribe to 3 events:

  - READY: called right before attempting to acquire the GVL
  - RESUMED: called right after successfully acquiring the GVL
  - SUSPENDED: called right after releasing the GVL.

The hooks MUST be threadsafe, as they are executed outside of the GVL, they also MUST NOT call any Ruby API.
2022-06-03 15:13:33 +02:00
..
backward Check if __assume is supported 2022-02-19 23:32:52 +09:00
fiber [DOC] add missing size params in fiber scheduler.h (#5441) 2022-04-14 07:34:49 +12:00
internal Remove trailing comma from FL_USER3 (#5958) 2022-05-26 15:40:34 -07:00
io Add fiber scheduler hooks for pread/pwrite, and add support to IO::Buffer. 2021-12-23 12:20:09 +13:00
assert.h
atomic.h
backward.h Revert "Finer-grained inline constant cache invalidation" 2022-03-25 20:29:09 +09:00
debug.h
defines.h
encoding.h
intern.h
io.h [Doc] correct my understanding about nonblocking mode 2022-04-21 14:59:03 +09:00
memory_view.h
missing.h [wasm] wasm/missing.{c,h}: add missing libc stubs for wasi-libc 2022-01-19 11:19:06 +09:00
onigmo.h re.c: Add Regexp.timeout= and Regexp.timeout 2022-03-30 16:50:46 +09:00
oniguruma.h
ractor.h
random.h
re.h
regex.h
ruby.h [Feature #18249] Implement ABI checking 2022-02-22 09:55:21 -05:00
st.h
subst.h
thread.h [Feature #18339] GVL Instrumentation API 2022-06-03 15:13:33 +02:00
thread_native.h [wasm] add no thread variant for freestanding environment 2022-01-19 11:19:06 +09:00
util.h
version.h Development of 3.1.0 started. 2021-12-26 23:22:26 +09:00
vm.h
win32.h include/ruby/win32.h: explicitly define HAVE_SHUTDOWN 2022-01-19 17:52:19 +09:00