зеркало из https://github.com/github/ruby.git
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:
Родитель
751c64f8cb
Коммит
2244bf5716
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче