diff options
author | Koichi Sasada <[email protected]> | 2023-12-18 21:40:43 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2023-12-19 02:26:37 +0900 |
commit | 6c4b04de5cba36077f86b08d54c4c316f3df1d87 (patch) | |
tree | 6f3f774a980b0f5f19f40788c2abf51e5660a8c5 /thread_pthread.c | |
parent | f35fec771047de15127c0e00d22b9eccd5487f51 (diff) |
clear `sched->lock_onwer` at fork
`sched->lock_owner` can be non-NULL at fork because the timer thread
can acquire the lock while forking. `lock_owner` information is for
debugging, so we only need to clear it at fork.
I hope this patch fixes the following assertion failure:
```
thread_pthread.c:354:thread_sched_lock_:sched->lock_owner == NULL
```
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/thread_pthread.c b/thread_pthread.c index 64b636ec08..e7e827793b 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1129,6 +1129,11 @@ void rb_thread_sched_init(struct rb_thread_sched *sched, bool atfork) { rb_native_mutex_initialize(&sched->lock_); + +#if VM_CHECK_MODE + sched->lock_owner = NULL; +#endif + ccan_list_head_init(&sched->readyq); sched->readyq_cnt = 0; |