From: "Chris Friesen" <cfriesen@nortel.com>
To: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
tglx@linutronix.de
Subject: BUG? timer_create() with SIGEV_THREAD not working (at least on ppc64)
Date: Tue, 18 Nov 2008 10:14:36 -0600 [thread overview]
Message-ID: <4922E9EC.3070606@nortel.com> (raw)
The code below sets up a simple timer with SIGEV_THREAD. I compiled the
code as "g++ timertest.cc -o timertest -lrt -pthread".
Running it on my G5 with 2.6.27 (but with an older glibc), it prints:
Creating timer
Setting timer 268509264 for 5-second expiration...
and then the timer never expires. I have an old Fedora Core 4 x86
machine and there it works as expected.
Is there some hard requirement to upgrade glibc? If not, then this
looks like a bug somewhere.
Thanks,
Chris
int main(void)
{
timer_t timer_id;
struct itimerspec its;
struct sigevent se;
// set timer signal event
se.sigev_notify = SIGEV_THREAD;
se.sigev_value.sival_ptr = &timer_id;
se.sigev_notify_function = handler;
se.sigev_notify_attributes = NULL;
if ( timer_create(CLOCK_REALTIME, &se, &timer_id) < 0)
{
printf("create timer failed\n");
fflush(0);
return 0;
}
// set timer.
its.it_value.tv_sec = 1;
its.it_value.tv_nsec = 0;
its.it_interval.tv_sec = 1;
its.it_interval.tv_nsec = 0;
if ( timer_settime(timer_id, 0, &its, NULL) < 0)
{
printf("set timer failed\n");
fflush(0);
return 0;
}
printf("set timer OK\n");
fflush(0);
while(1)
{ pause();}
return 0;
}
WARNING: multiple messages have this Message-ID (diff)
From: "Chris Friesen" <cfriesen@nortel.com>
To: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
tglx@linutronix.de
Subject: BUG? timer_create() with SIGEV_THREAD not working (at least on ppc64)
Date: Tue, 18 Nov 2008 10:14:36 -0600 [thread overview]
Message-ID: <4922E9EC.3070606@nortel.com> (raw)
The code below sets up a simple timer with SIGEV_THREAD. I compiled the
code as "g++ timertest.cc -o timertest -lrt -pthread".
Running it on my G5 with 2.6.27 (but with an older glibc), it prints:
Creating timer
Setting timer 268509264 for 5-second expiration...
and then the timer never expires. I have an old Fedora Core 4 x86
machine and there it works as expected.
Is there some hard requirement to upgrade glibc? If not, then this
looks like a bug somewhere.
Thanks,
Chris
int main(void)
{
timer_t timer_id;
struct itimerspec its;
struct sigevent se;
// set timer signal event
se.sigev_notify = SIGEV_THREAD;
se.sigev_value.sival_ptr = &timer_id;
se.sigev_notify_function = handler;
se.sigev_notify_attributes = NULL;
if ( timer_create(CLOCK_REALTIME, &se, &timer_id) < 0)
{
printf("create timer failed\n");
fflush(0);
return 0;
}
// set timer.
its.it_value.tv_sec = 1;
its.it_value.tv_nsec = 0;
its.it_interval.tv_sec = 1;
its.it_interval.tv_nsec = 0;
if ( timer_settime(timer_id, 0, &its, NULL) < 0)
{
printf("set timer failed\n");
fflush(0);
return 0;
}
printf("set timer OK\n");
fflush(0);
while(1)
{ pause();}
return 0;
}
next reply other threads:[~2008-11-18 16:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-18 16:14 Chris Friesen [this message]
2008-11-18 16:14 ` BUG? timer_create() with SIGEV_THREAD not working (at least on ppc64) Chris Friesen
2008-11-18 20:33 ` Chris Friesen
2008-11-18 20:33 ` Chris Friesen
2008-11-18 23:06 ` Chris Friesen
2008-11-18 23:06 ` Chris Friesen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4922E9EC.3070606@nortel.com \
--to=cfriesen@nortel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=tglx@linutronix.de \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.