summaryrefslogtreecommitdiff
path: root/ext/-test-/thread
AgeCommit message (Collapse)Author
2025-05-08Add depend files under ext/-test-Nobuyoshi Nakada
Notes: Merged: https://.com/ruby/ruby/pull/13272
2025-04-03Fix timeline_value not being marked in testJohn Hawthorn
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
2024-06-04Remove dependency on fiddle from test/rubyHiroshi SHIBATA
Co-authored-by: "Nobuyoshi Nakada" <[email protected]>
2024-04-27ruby tool/update-deps --fix卜部昌平
2024-02-26Fix compilation for platforms without pthreadPierrick Bouvier
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
2024-02-21`rb_thread_lock_native_thread()`Koichi Sasada
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)
2023-11-28Further fix the GVL instrumentation APIJean Boussier
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.
2023-11-27Refactor and fix the GVL instrumentation APIJean Boussier
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]>
2023-11-13GVL Instrumentation: pass thread->self as part of event dataJean Boussier
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.
2023-04-07[Bug#19161] Detect thread local storage specifierNobuyoshi Nakada
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
2023-02-28Update the depend filesMatt Valentine-House
Notes: Merged: https://.com/ruby/ruby/pull/7310
2023-02-27Remove intern/gc.h from Make depsMatt Valentine-House
Notes: Merged: https://.com/ruby/ruby/pull/7330
2023-02-08Extract include/ruby/internal/attr/packed_struct.hNobuyoshi Nakada
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
2022-07-08Make a local symbol staticNobuyoshi Nakada
2022-07-07thread_pthread.c: call SUSPENDED event when entering native_sleepJean Boussier
[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
2022-06-19Remove unnecessary `*` before the function nameNobuyoshi Nakada
2022-06-17GVL Instrumentation API: add STARTED and EXITED eventsJean Boussier
[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
2022-06-03[Feature #18339] GVL Instrumentation APIJean Boussier
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