From: Eric Wong <normalperson@yhbt.net>
To: sleepy.penguin@librelist.org
Subject: [sleepy.penguin] [PATCH 1/2] epoll: use pthread_once properly
Date: Thu, 24 Jan 2013 00:47:14 +0000 [thread overview]
Message-ID: <1358988435-16017-1-git-send-email-normalperson@yhbt.net> (raw)
In-Reply-To: <1358988435-16017-1-git-send-email-normalperson@yhbt.net>
pthread_once_t must be static to be effective. This bug only
affects apps which load sleepy_penguin multiple times.
---
ext/sleepy_penguin/epoll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/sleepy_penguin/epoll.c b/ext/sleepy_penguin/epoll.c
index 2b7f5c1..7297f70 100644
--- a/ext/sleepy_penguin/epoll.c
+++ b/ext/sleepy_penguin/epoll.c
@@ -682,7 +682,7 @@ static void epoll_once(void)
void sleepy_penguin_init_epoll(void)
{
VALUE mSleepyPenguin, cEpoll;
- pthread_once_t once = PTHREAD_ONCE_INIT;
+ static pthread_once_t once = PTHREAD_ONCE_INIT;
int err = pthread_once(&once, epoll_once);
if (err) {
--
1.8.1.46.gcb3a6ab
next parent reply other threads:[~2013-01-24 0:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 0:47 Eric Wong [this message]
2013-01-24 0:47 ` [sleepy.penguin] [PATCH 2/2] epoll: update documentation for multi-threaded use Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/sleepy_penguin/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358988435-16017-1-git-send-email-normalperson@yhbt.net \
--to=normalperson@yhbt.net \
--cc=sleepy.penguin@librelist.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/sleepy_penguin.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).