ISO Example for reading/writing uart/rs-232
Marc Lehmann
schmorp at schmorp.de
Tue Dec 15 19:45:12 CET 2015
On Tue, Dec 15, 2015 at 01:41:37PM +0100, Thilo Schulz <thilo at tjps.eu> wrote:
> On Tuesday 15 December 2015 05:12:04 you wrote:
> > Probably not. Another scenario: Could I put the read
> > callback into a separate thread than the write callback (if say we are
> > using a rs-485 asynchronous 4 wire uart)? Thanks!
>
> You can. Why would you want to, though?
If you go this route, make sure you read the thread locking example in the
manpage: in the past, a lot of people forgot to lopck the event loop, and
it's not trivial.
And indeed, why would you want to, it complicates things a lot. It would be
much easier to use one event loop per thread, or simply use blocking I/O in
the threads (assuming you don't have a very high number of ports).
The advantage of using an event loop is mainly to not have to use threads.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the libev
mailing list