This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug nptl/14484] sem_timedwait always return -1 with errno 110 (ETIMEDOUT).
- From: "tingw.liu at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Wed, 22 Aug 2012 05:20:34 +0000
- Subject: [Bug nptl/14484] sem_timedwait always return -1 with errno 110 (ETIMEDOUT).
- Auto-submitted: auto-generated
- References: <bug-14484-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=14484
--- Comment #11 from tingweiliu <tingw.liu at gmail dot com> 2012-08-22 05:20:34 UTC ---
(In reply to comment #10)
> All your time calculation code is rather obfuscated and I haven't waded though
> it yet, but I suspect you're just confusing microseconds and nanoseconds. The
> fact that you're mixing interfaces that use timeval with ones that use timespec
> does not help. I would switch to using POSIX timespec interfaces for everything
> (timer_create for timers, clock_gettime for current time, etc.).
> If it really is timing out early, this is probably due to the Linux kernel bug
> for signal handlers interrupting syscalls with timeouts.
OK...
Can you tell me why the output is different with the same system.(Linux 2.6.32)
gcc sem_timedwait.c -lrt -o sem_timedwait
One is like:
#./sem_timedwait
sem_timedwait ret=-1 failed.errno=110 Real timeout=4us
sem_timedwait ret=-1 failed.errno=110 Real timeout=4us
sem_timedwait ret=-1 failed.errno=110 Real timeout=4us
sem_timedwait ret=-1 failed.errno=110 Real timeout=4us
Another is like:
#./sem_timedwait
sem_timedwait ret=-1 failed.errno=4 Real timeout=3948us
sem_timedwait ret=-1 failed.errno=4 Real timeout=3929us
sem_timedwait ret=-1 failed.errno=4 Real timeout=3958us
sem_timedwait ret=-1 failed.errno=4 Real timeout=4149us
sem_timedwait ret=-1 failed.errno=4 Real timeout=3967us
sem_timedwait ret=-1 failed.errno=4 Real timeout=3818us
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.