This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [greg@surety.com] libc/1320: pthread_cond_timedwait returns EINTR in multithreaded processes when gdb is attached to them


Hi,

>SUS2 says that pthread_cond_timedwait must never return with EINTR.  If it
>is interrupted it must either continue waiting or return zero.  I think
>continue waiting is the desired action.
>
>I'm not sure whether this is the right way to fix the bug.

Are you sure you want to do this?  

Before we started using pthread_cancel and longjmping out of the cleanup handler 
clean-up handler, the JDK (Blackdown) used to use a signal to interrupt threads 
waiting in condvar_timed_wait and relied on the EINTR to do the trick.

The problem with this approach was that it could miss signals, but people may 
still want to be able to break out of timed_waits (you can implement 
condvar_wait with condvar_timed_wait and break out of both with a signal).

What does the pthreads spec say about condvar_timed_wait and returning EINTR?

My 2 cents,

Kevin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]