--- Quote Start ---
originally posted by fidodido@Feb 9 2006, 02:38 AM
hello to everybody,
i'm developing an application made by several task. i'd like to receive data from uart in asynchronous way. so i has a main loop that continuously execute some task and sometime need to execute a gets() to capture data from uart and store them.
the problem is due to the fact that the gets() is a blocking function and don’t return until new data arrive on uart so the mail loop is on hold.
how can i resolve this problem?
regards !
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=12652)
--- quote end ---
--- Quote End ---
I'm having the same problem. What's more is that if I set the O_NONBLOCK flag, a send buffer overrun occurs because it's not blocking on the output messages I'm sending. I'd like for it to block on send (to wait for room in the buffer), but not block on receive commands.
I would expect a command like feof() to return TRUE if the receive buffer is empty, or at least have a similar function call be available to poll the buffer before a blocking receive command. But I've found nothing. Instead, the only thing that seems to work on the receive side of things is to use the NONBLOCK option. Is there something I'm missing?
Thanks,
Drew