Stuart Hughes wrote:
>
> Ralf Ramrath wrote:
> >
> > Hi folks,
> >
> > I have the following problem:
> >
> > I have a "main thread" that has to read data from the serial port only if
> > any data is available. On the other hand, the thread must not wait longer
> > than let's say one second.
>
> Hi Ralf,
>
> IMHO, the correct way to handle this would be to use
> pthread_cond_timedwait. Unfortunately neither RTL or RTAI currently
> implement this.
Hi:
With RTAI you could do this:
Use an agent that blocks until all the data is received and then rt_trigger()'s
a non blocking proxy message back to the main thread.
The main thread can check in a non blocking way with the primitive
rt_receive_until() for the proxy message. When the proxy comes in, it can
rt_rpc() the agent to obtain the complete packet. You get one proxy for
each complete packet, something easy to manage.
Clearly, everything is there to do that sort of thing.
Best Regards,
Pierre
--
--------------------------
- Poseidon Controls Inc. -
- Phone: (450)-659-9186 -
- Fax: (450)-659-0014 -
-- [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/