Re: phtread_create while pthread_cond_timedwait in gdb



David Schwartz <davids@xxxxxxxxxxxxx> writes:

On Jun 26, 8:32 am, arkadius.nowakow...@xxxxxxxxxxxxxx wrote:

Thank you!

I could not find any information about these "bugs".
Didn't nobody came along this until now?
Are there any fixes for this?

I'm sorry, what bug? You are seeing two different behaviors, one with
gdb and one without. But both behaviors are equally reasonable, and
the code doesn't do anything to force one behavior over the other.

http://www.opengroup.org/onlinepubs/000095399/functions/pthread_cond_wait.html

<quote>
The pthread_cond_timedwait() function shall be equivalent to
pthread_cond_wait(), except that an error is returned if the absolute
time specified by abstime passes (that is, system time equals or
exceeds abstime) before the condition cond is signaled or broadcasted,
or if the absolute time specified by abstime has already been passed
at the time of the call.
</quote>

On his system the time has NOT passed yet the call returns ETIMEDOUT,
this contradicts the above text.

On my system the call never returns at all.


This is typical with multi-threaded code. Slight changes in the system
or environment can result in different behavior.

If you care if 'pthread_cond_timedwait' returns early, call it in a
loop.
http://en.wikipedia.org/wiki/Spurious_wakeup

Spurious wakeups have nothing to do with it.

It is not a bug if the same program does two different things under
the same or different conditions unless one of those two things is
unreasonable.

DS

--
mailto:av1474@xxxxxxxx
.



Relevant Pages

  • Re: phtread_create while pthread_cond_timedwait in gdb
    ... You are seeing two different behaviors, ... exceeds abstime) before the condition cond is signaled or broadcasted, ... but humans have builtin clock with high enough ...
    (comp.os.linux.development.apps)
  • Re: phtread_create while pthread_cond_timedwait in gdb
    ... You are seeing two different behaviors, ... exceeds abstime) before the condition cond is signaled or broadcasted, ... but humans have builtin clock with high enough ... future using realtime clock, mine does so with either realtime or ...
    (comp.os.linux.development.apps)
  • Re: phtread_create while pthread_cond_timedwait in gdb
    ... I'm sorry, what bug? ... You are seeing two different behaviors, ... exceeds abstime) before the condition cond is signaled or broadcasted, ...
    (comp.os.linux.development.apps)
  • Re: phtread_create while pthread_cond_timedwait in gdb
    ... I'm sorry, what bug? ... You are seeing two different behaviors, ... exceeds abstime) before the condition cond is signaled or broadcasted, ... It works as one would assume here, gdb notwithstanding. ...
    (comp.os.linux.development.apps)
  • Re: phtread_create while pthread_cond_timedwait in gdb
    ... Are there any fixes for this? ... You are seeing two different behaviors, ... This is typical with multi-threaded code. ... It is not a bug if the same program does two different things under ...
    (comp.os.linux.development.apps)