Actually, a combination of Mutex and Conditions sound like a solution. You 
can wait on a condition either for a specific time, or until your thread 
receives a signal. When the thread waits on the condition, the mutex is 
released. When the condition expires, the mutex is automatically 
reacquired. Do a man on pthread_cond_wait and pthread_mutex_lock
Cole Tuininga wrote:
> On Mon, Jul 30, 2001 at 06:36:58PM -0400, List Monkey wrote:
> > 
> > Mutexes would indded be the way to go if it makes sense for your
> > achitecture.
> > 
> > Another approach is to base your time on SYSTEM UPTIME.  This is available
> > by writing a little hack to read the kernel global "jiffies", or read
> >  /proc/uptime
> 
> Hmmm ... this is an approach I hadn't thought of ... it might just work.
> Is there a portable way to get system uptime?
>  
> > If the server is always online, you could just query the NIST atomic clock
> 
> *chuckle*  It's an idea, but I think it's a little more overhead than 
> I wanted.  8)
> 
> > Make a separate thread that just sleeps some small time, increments a
> > global counter atomically, ad infinitum.
> 
> The problem with this approach is that if the CPU gets loaded, the
> timing starts (potentially) getting off.  The more consistent the high load,
> the more askew the timing becomes.  
> 
> Decent approach though.
> 
> -- 
> Give a person a fish and you feed them for a day.
> Give a person access to the net and they won't bother you for weeks.
> -- Internet proverb
> 
> Cole Tuininga
> Network Admin
> Code Energy, Inc
> [EMAIL PROTECTED]
> (603) 766-2208
> PGP Key ID: 0x43E5755D
> 
> 
> 
> **********************************************************
> To unsubscribe from this list, send mail to
> [EMAIL PROTECTED] with the following text in the
> *body* (*not* the subject line) of the letter:
> unsubscribe gnhlug
> **********************************************************
> 

-- 
Jerry Feldman <[EMAIL PROTECTED]>
Boston Linux and Unix user group
http://www.blu.org



**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to