summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-01 04:41:10 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-01 04:41:10 +0000
commit496ddbc275049fbfe2ab1e320903dab0beec0fd3 (patch)
tree831422bcb7974e41780745c3b2f9ab6ac5459c46 /thread.c
parent766ee6e55077a9cb2fd1f3092a95b5ded795161f (diff)
LIST_HEAD as a local variable is a C99ism.
Address of a variable whose storage duration is `auto` is _not_ a compile time constant, according to ISO 9899 section 6.4. LIST_HEAD takes such thing. You can't use it to declare local variables. Interestingly, address of a static variable _is_ a compile time constant. So a declaration like `static LIST_HEAD..` is completely legal even in C90. In C99 and newer, this is not a constraint violation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index 00d8b43986..7ca6625d7c 100644
--- a/thread.c
+++ b/thread.c
@@ -2288,7 +2288,8 @@ rb_notify_fd_close(int fd, struct list_head *busy)
void
rb_thread_fd_close(int fd)
{
- LIST_HEAD(busy);
+ struct list_head busy;
+ busy.n.next = busy.n.prev = &busy.n;
if (rb_notify_fd_close(fd, &busy)) {
do rb_thread_schedule(); while (!list_empty(&busy));