1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

thread_pthread.c: use container_of

It's easier to read this macro from ccan than open-coding pointer
arithmetic.

thread_pthread.c (ubf_wakeup_all_threads): use container_of

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2018-01-02 21:23:47 +00:00
parent 751c64f8cb
commit 2244bf5716

View file

@ -1226,8 +1226,7 @@ ubf_wakeup_all_threads(void)
if (!ubf_threads_empty()) {
native_mutex_lock(&ubf_list_lock);
list_for_each(&ubf_list_head, dat, ubf_list) {
th = (rb_thread_t *)(
((char *)dat) - offsetof(rb_thread_t, native_thread_data));
th = container_of(dat, rb_thread_t, native_thread_data);
ubf_wakeup_thread(th);
}
native_mutex_unlock(&ubf_list_lock);