Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] Allow callbacks to be registered for GVL related events #119

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Stub rb_gvl_event_* on win32
  • Loading branch information
byroot committed Jan 27, 2022
commit 1f599a6b34c901a1c919c07745a3a915830ed72a
1 change: 0 additions & 1 deletion include/ruby/thread_native.h
Original file line number Diff line number Diff line change
@@ -220,6 +220,5 @@ typedef struct gvl_hook {

gvl_hook_t * rb_gvl_event_new(void *callback, rb_event_flag_t event);
bool rb_gvl_event_delete(gvl_hook_t * hook);
void rb_gvl_execute_hooks(rb_event_flag_t event, rb_atomic_t waiting);
RBIMPL_SYMBOL_EXPORT_END()
#endif
2 changes: 1 addition & 1 deletion thread_pthread.c
Original file line number Diff line number Diff line change
@@ -151,7 +151,7 @@ rb_gvl_event_delete(gvl_hook_t * hook) {
return success;
}

void
static void
rb_gvl_execute_hooks(rb_event_flag_t event, rb_atomic_t waiting) {
if (pthread_rwlock_rdlock(&rb_gvl_hooks_rw_lock)) {
rb_bug("GVL hooks deadlock");
10 changes: 10 additions & 0 deletions thread_win32.c
Original file line number Diff line number Diff line change
@@ -35,6 +35,16 @@ static volatile DWORD ruby_native_thread_key = TLS_OUT_OF_INDEXES;

static int w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th);

gvl_hook_t *
rb_gvl_event_new(void *callback, rb_event_flag_t event) {
// not implemented yet
}

bool
rb_gvl_event_delete(gvl_hook_t * hook) {
// not implemented yet
}

RBIMPL_ATTR_NORETURN()
static void
w32_error(const char *func)