From 5471bf9cc2ee4cab19f9f306aced64d0649fd672 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Tue, 2 Jan 2018 06:41:56 +0000 Subject: offsetof(type, foo.bar) is (arguably) a GCCism TL;DR see http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2031.htm Suppose we have: struct X { struct Y { z_t z; } y; } x; then, you _cant_ infer offsetof(struct X, y.z). The ISO C99 section 7.17 says nothing about such situation. At least clang warns this being an extension to the language (-Wextended-offsetof). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_pthread.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'thread_pthread.c') diff --git a/thread_pthread.c b/thread_pthread.c index 686c219ecb..469c9748b2 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1221,11 +1221,13 @@ static void ubf_wakeup_all_threads(void) { rb_thread_t *th; + native_thread_data_t *dat; if (!ubf_threads_empty()) { native_mutex_lock(&ubf_list_lock); - list_for_each(&ubf_list_head, th, - native_thread_data.ubf_list) { + list_for_each(&ubf_list_head, dat, ubf_list) { + th = (rb_thread_t *)( + ((char *)dat) - offsetof(rb_thread_t, native_thread_data)); ubf_wakeup_thread(th); } native_mutex_unlock(&ubf_list_lock); -- cgit v1.2.3