Re: Introduce timeout capability for ConditionVariableSleep

Shawn Debnath <sdn@amazon.com>

From: Shawn Debnath <sdn@amazon.com>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: <thomas.munro@gmail.com>, <pgsql-hackers@postgresql.org>
Date: 2019-03-21T18:20:50Z
Lists: pgsql-hackers

Attachments

On Sat, Mar 16, 2019 at 03:27:17PM -0700, Shawn Debnath wrote:
> > +     * Track the current time so that we can calculate the 
> > remaining timeout
> > +     * if we are woken up spuriously.
> > 
> > I think tha "track" means chasing a moving objects. So it might
> > be bettter that it is record or something?
> > 
> > >   * Wait for the given condition variable to be signaled or till timeout.
> > >   *
> > >   * Returns -1 when timeout expires, otherwise returns 0.
> > >   *
> > >   * See ConditionVariableSleep() for general usage.
> > > 
> > > > +ConditionVariableTimedSleep(ConditionVariable *cv, long timeout,
> > > > 
> > > > Counldn't the two-state return value be a boolean?
> 
> I will change it to Record in the next iteration of the patch.

Posting rebased and updated patch. Changed the word 'Track' to 'Record' 
and also changed variable name rem_timeout to cur_timeout to match 
naming in other use cases.


-- 
Shawn Debnath
Amazon Web Services (AWS)

Commits

  1. Forward received condition variable signals on cancel.

  2. Introduce timed waits for condition variables.