Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: daniels@biles.com (Brad Daniels)
Subject: Re: Race condition during object destruction.  How to avoid?
Date: Thu, 19 May 1994 20:48:59 GMT	[thread overview]
Message-ID: <Cq2Hto.G5K@biles.com> (raw)
In-Reply-To: CBARBER.94May19112914@apricot.bbn.com

In article <CBARBER.94May19112914@apricot.bbn.com>,
Christopher Barber <cbarber@bbn.com> wrote:
>>>>>> "BD" == Brad Daniels <daniels@biles.com> writes:
>
>    BD> I have a class which models pthread condition variables.  I'd like
>    BD> to make a subclass of that class which will wake up at fixed
>    BD> intervals regardless of other conditions.  To achieve this, I tried
>    BD> making a class with an associated thread which periodically signals
>    BD> the condition variable to wake up (after forcing the predicate to
>    BD> be true)....
>    
>Why not save yourself a lot of trouble and implement the wait() call on the
>subclass using pthread_cond_timedwait()?

That is actually the work-around I put in, though I have to use
pthread_getexpiration_np in order to figure out the end time, and I hate
using _np routines.  Another part of the problem with this approach is
that the timing is less reliable.  I have to determine the time for the next
read before commencing the read, so that my interval isn't (time for read to
complete) + interval instead of just the given interval.  Also, if a network
event causes a read to take longer than the interval, I will get two reads,
one immediately after the other, with the next read thereafter commencing
at a new offset (e.g. I might get reads starting at 10 sec, 20 sec, 30 sec,
42 sec, 52 sec, etc.)  For my current purposes, this shouldn't be a problem,
but I'd like to code something more reliable if possible.

- Brad
------------------------------------------------------------
+ Brad Daniels                  | Was mich nicht umbringt  +
+ Biles and Associates          | macht mich hungrig.      +
+ These are my views, not B&A's |                          +
------------------------------------------------------------


      reply	other threads:[~1994-05-19 20:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-05-18 18:18 Race condition during object destruction. How to avoid? Brad Daniels
1994-05-19 15:29 ` Christopher Barber
1994-05-19 20:48   ` Brad Daniels [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox