Age | Commit message (Collapse) | Author |
---|
| Notes: Merged: https://.com/ruby/ruby/pull/13272 |
| T_DATA with a NULL pointer are not marked. Let's wrap 1 instead to ensure that our mark function is actually run. Notes: Merged: https://.com/ruby/ruby/pull/13047 |
| Co-authored-by: "Nobuyoshi Nakada" <[email protected]> |
| |
| Found when compiling ruby for windows-arm64 using msys2 Missing return type for function Init_lock_native_thread lock_native_thread.c:45:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] 45 | Init_lock_native_thread(void) | ^ | int |
| Introduce `rb_thread_lock_native_thread()` to allocate dedicated native thread to the current Ruby thread for M:N threads. This C API is similar to Go's `runtime.LockOSThread()`. Accepted at https://.com/ruby/dev-meeting-log/blob/master/2023/DevMeeting-2023-08-24.md (and missed to implement on Ruby 3.3.0) |
| Followup: https://.com/ruby/ruby/pull/9029 [Bug #20019] Some events still weren't triggered from the right place. The test suite was also improved a bit more. |
| 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é <[email protected]> Co-Authored-By: JP Camara <[email protected]> Co-Authored-By: John Hawthorn <[email protected]> |
| Context: https://.com/ivoanjo/gvl-tracing/pull/4 Some hooks may want to collect data on a per thread basis. Right now the only way to identify the concerned thread is to use `rb_nativethread_self()` or similar, but even then because of the thread cache or MaNy, two distinct Ruby threads may report the same native thread id. By passing `thread->self`, hooks can use it as a key to store the metadata. NB: Most hooks are executed outside the GVL, so such data collection need to use a thread-safe data-structure, and shouldn't use the reference in other ways from inside the hook. They must also either pin that value or handle compaction. |
| Checking by `__STDC_VERSION__` is unreliable because old gcc 4.8 supports `-std=gnu11` option but does not implement `_Thread_local`. Check the implementation directly instead. Notes: Merged: https://.com/ruby/ruby/pull/7669 |
| Notes: Merged: https://.com/ruby/ruby/pull/7310 |
| Notes: Merged: https://.com/ruby/ruby/pull/7330 |
| Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the macros bellow: * `RBIMPL_ATTR_PACKED_STRUCT_BEGIN` * `RBIMPL_ATTR_PACKED_STRUCT_END` * `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN` * `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END` Notes: Merged: https://.com/ruby/ruby/pull/7268 |
| |
| [Bug #18900] Thread#join and a few other codepaths are using native sleep as a way to suspend the current thread. So we should call the relevant hook when this happen, otherwise some thread may transition directly from `RESUMED` to `READY`. Notes: Merged: https://.com/ruby/ruby/pull/6101 |
| |
| [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: Merged: https://.com/ruby/ruby/pull/6029 |
| 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. Notes: Merged: https://.com/ruby/ruby/pull/5500 |