1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext
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
..
-test- [Feature #18339] GVL Instrumentation API 2022-06-03 15:13:33 +02:00
bigdecimal
cgi/escape
continuation
coverage
date
digest
etc
fcntl
fiddle
io
json
monitor
nkf [ruby/nkf] Constified invariant tables 2022-06-03 20:25:12 +09:00
objspace
openssl
pathname
psych
pty
racc/cparse
rbconfig/sizeof
readline
ripper
rubyvm
socket
stringio
strscan
syslog
win32
win32ole
zlib
.document
extmk.rb
Setup
Setup.atheos
Setup.nt