File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -90,9 +90,16 @@ static const void *const condattr_monotonic = NULL;
90
90
#endif
91
91
#endif
92
92
93
+ #ifdef HAVE_SCHED_YIELD
94
+ #define native_thread_yield () (void)sched_yield()
95
+ #else
96
+ #define native_thread_yield () ((void)0)
97
+ #endif
98
+
93
99
// native thread wrappers
94
100
95
101
#define NATIVE_MUTEX_LOCK_DEBUG 0
102
+ #define NATIVE_MUTEX_LOCK_DEBUG_YIELD 0
96
103
97
104
static void
98
105
mutex_debug (const char * msg , void * lock )
111
118
rb_native_mutex_lock (pthread_mutex_t * lock )
112
119
{
113
120
int r ;
121
+ #if NATIVE_MUTEX_LOCK_DEBUG_YIELD
122
+ native_thread_yield ();
123
+ #endif
114
124
mutex_debug ("lock" , lock );
115
125
if ((r = pthread_mutex_lock (lock )) != 0 ) {
116
126
rb_bug_errno ("pthread_mutex_lock" , r );
@@ -310,12 +320,6 @@ static rb_serial_t current_fork_gen = 1; /* We can't use GET_VM()->fork_gen */
310
320
311
321
static void threadptr_trap_interrupt (rb_thread_t * );
312
322
313
- #ifdef HAVE_SCHED_YIELD
314
- #define native_thread_yield () (void)sched_yield()
315
- #else
316
- #define native_thread_yield () ((void)0)
317
- #endif
318
-
319
323
static void native_thread_dedicated_inc (rb_vm_t * vm , rb_ractor_t * cr , struct rb_native_thread * nt );
320
324
static void native_thread_dedicated_dec (rb_vm_t * vm , rb_ractor_t * cr , struct rb_native_thread * nt );
321
325
static void native_thread_assign (struct rb_native_thread * nt , rb_thread_t * th );
You can’t perform that action at this time.
0 commit comments