No such thing as a small change | |
PerlMonks |
Re: Mixing asynchronous data feed with synchronous program flow controlby jcb (Parson) |
on Jan 02, 2020 at 04:35 UTC ( [id://11110859]=note: print w/replies, xml ) | Need Help?? |
It looks reasonable to me. Process the arriving data in an asynchronous callback and arrange timer events for any synchronous commands that need to be issued, sending the commands in the timer callback. Another option would be to have one process handling both data and commands asynchronously and a synchronous process that talks to that multiplexer and makes the decisions. Event-driven programming is just messy like this.
In Section
Seekers of Perl Wisdom
|
|