Skip to content

Commit

Permalink
define rb_current_ec_set in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
eightbitraptor committed Nov 25, 2024
1 parent 551be82 commit f127bcb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
8 changes: 0 additions & 8 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,7 @@ rb_gc_worker_thread_set_vm_context(struct rb_gc_vm_context *context)
GC_ASSERT(rb_current_execution_context(false) == NULL);

#ifdef RB_THREAD_LOCAL_SPECIFIER
# ifdef __APPLE__
rb_current_ec_set(context->ec);
# else
ruby_current_ec = context->ec;
# endif
#else
native_tls_set(ruby_current_ec_key, context->ec);
#endif
Expand All @@ -218,11 +214,7 @@ rb_gc_worker_thread_unset_vm_context(struct rb_gc_vm_context *context)
GC_ASSERT(rb_current_execution_context(true) == context->ec);

#ifdef RB_THREAD_LOCAL_SPECIFIER
# ifdef __APPLE__
rb_current_ec_set(NULL);
# else
ruby_current_ec = NULL;
# endif
#else
native_tls_set(ruby_current_ec_key, NULL);
#endif
Expand Down
9 changes: 3 additions & 6 deletions ractor_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,18 +306,15 @@ rb_ractor_thread_switch(rb_ractor_t *cr, rb_thread_t *th)
}

#define rb_ractor_set_current_ec(cr, ec) rb_ractor_set_current_ec_(cr, ec, __FILE__, __LINE__)
#ifdef RB_THREAD_LOCAL_SPECIFIER
void rb_current_ec_set(rb_execution_context_t *ec);
#endif

static inline void
rb_ractor_set_current_ec_(rb_ractor_t *cr, rb_execution_context_t *ec, const char *file, int line)
{
#ifdef RB_THREAD_LOCAL_SPECIFIER

# ifdef __APPLE__
rb_current_ec_set(ec);
# else
ruby_current_ec = ec;
# endif

#else
native_tls_set(ruby_current_ec_key, ec);
#endif
Expand Down

0 comments on commit f127bcb

Please sign in to comment.