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 Align the implementation precedences with rb_atomic_t definition 2021-09-24 10:11:32 +09:00
backward.h Revert "Finer-grained inline constant cache invalidation" 2022-03-25 20:29:09 +09:00
debug.h include/ruby/debug.h: add doxygen 2021-09-10 20:00:06 +09:00
defines.h include/ruby/defines.h: add doxygen 2021-09-10 20:00:06 +09:00
encoding.h split include/ruby/encoding.h 2021-10-05 14:18:23 +09:00
intern.h
io.h [Doc] correct my understanding about nonblocking mode 2022-04-21 14:59:03 +09:00
memory_view.h memory_view.c: Add _memory_view_entry member in rb_memory_view_t (#5088) 2021-11-08 12:52:09 +09:00
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 Fix typos 2021-11-02 19:17:37 +09:00
random.h include/ruby/random.h: add doxygen 2021-09-10 20:00:06 +09:00
re.h include/ruby/re.h: add doxygen 2021-09-10 20:00:06 +09:00
regex.h include/ruby/regex.h: skip doxygen 2021-09-10 20:00:06 +09:00
ruby.h [Feature #18249] Implement ABI checking 2022-02-22 09:55:21 -05:00
st.h
subst.h include/ruby/subst.h: skip doxygen 2021-09-10 20:00:06 +09:00
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 ruby_scan_oct, ruby_scan_hex: are not pure 2021-09-10 20:00:06 +09:00
version.h Development of 3.1.0 started. 2021-12-26 23:22:26 +09:00
vm.h include/ruby/vm.h: add doxygen 2021-09-10 20:00:06 +09:00
win32.h include/ruby/win32.h: explicitly define HAVE_SHUTDOWN 2022-01-19 17:52:19 +09:00