[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Patch] Fix error path of pthread_cond_timedwait





Ulrich,

I had come up with the same fix that you have now in CVS but I  found
that it can lead to the following sequence of events

---------------------------------------------------------------------------------------------
Thread  A                                                Thread B

take condvar lock
     inc total_seq
release condvar lock

                                                take condvar lock
enable_async                                        if (total_seq >
wakeup_seq)
gettimeofday                                               inc wakeup_seq
TIMEOUT                                                   futex_wake
                                                release condvar lock

take condvar lock
     inc wakeup_seq
     inc woken_seq
release condvar lock

return
-------------------------------------------------------------------------------------------

As you can see this leads to the counters getting corrupted and again leads
to
the next pthread_cond_signal getting lost

The patch that I sent takes care of this scenario as well

Please apply

Regards,

Dinakar



                                                                                                                                     
                      Ulrich Drepper                                                                                                 
                      <drepper redhat c        To:       Dinakar Guniguntala/India/IBM IBMIN                                         
                      om>                      cc:       phil-list redhat com                                                        
                                               Subject:  Re: [Patch] Fix error path of pthread_cond_timedwait                        
                      02/17/2004 11:55                                                                                               
                      AM                                                                                                             
                                                                                                                                     
                                                                                                                                     



Dinakar Guniguntala wrote:

>  After debugging I found that on i386, there is an error path
> for the pthread_cond_timedwait call (on TIMEOUT) that updates the
sequence
> counters without holding a lock.

I've added last Friday a more efficient fix for this problem.  You can
test the current CVS sources.  I have added the one little optimization,
though.  Thanks,

--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]