On Mon, Mar 05, 2001 at 11:12:14AM -0800, Eric Peterson wrote:
> On Sat, Mar 03, 2001 at 06:00:17PM +0000, Stuart Hughes wrote:
> > Heinz Haeberle wrote:
> > >
> > > > Is it possible to do an pthread_suspend_np with a delay in
> > > > RT-Linux (3.0)? I'd like to suspend a task, but if he isn't
> > > > woken up (e.g. lost the interrupt), I want to pop out of the
> > > > suspend and poll.
> > > >
> > > > The easiest way I see is to use pthread_wait_np(), in a
> > > > periodic task, and use (if possible) pthread_wakeup_np() to
> > > > awaken it from the intr handler. But based on the man pages,
> > > > it isn't explicitly stated that I can "pthread_wakeup_np" a
> > > > thread that hasn't used pthread_suspend_np() to suspend
> > > > itself.
> > > that's what I am doing and it looks like it is working.
> > >
> > > Would really be nice to know if it just works by accident!
> > >
> >
> > Hi Heinz,
> >
> > The more conventional way to do this with pthreads is with a condition
> > variable, and the call pthread_cond_timedwait. In this case, your
> > thread wakes up when either the condition is signalled or you reach a
> > timeout. I'm not sure if this is in RTL, but I think I recall that it
> > is (check the docs).
>
> Stuart,
>
> Agreed, a condition variable is the "portable" way to do this, and
> it looks like RT-Linux 3.0 has them. I'm a bit suspicious though:
> if they _are_ supported, why should the manual still advocate the
> use of the pthread_{suspend/wakeup}_np() calls (instead of marking
> them as "compatibility" functions like the old rt_task_suspend(),
> etc.?)
Because they work and they are simple. Personally, I find the condvars
to be ugly, but they are supported in RTLinux and are
portable and some people even like 'em.
--
---------------------------------------------------------
Victor Yodaiken
Finite State Machine Labs: The RTLinux Company.
www.fsmlabs.com www.rtlinux.com
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/