summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-02 21:23:47 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-02 21:23:47 +0000
commit2244bf5716c0362aec8f4881fdca9f8f1457d9b3 (patch)
treec96cc6432b5ab082b4e47349fd8f945f0c7e98a7 /thread_pthread.c
parent751c64f8cb1002add35e65a30813e41442462a0c (diff)
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
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 469c9748b2..e1b20be58a 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -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);