• A fileevent question

    From Helmut Giese@hgiese@ratiosoft.com to comp.arch.embedded on Tue Feb 27 22:27:39 2024
    From Newsgroup: comp.arch.embedded

    Hello out there,
    just asking for inspiration.
    I have a simulation which executes commands - everything ok.
    But now the program should also communicate with external hardware via
    a serial connection and that is the problem:
    - I don't want to block waiting for an answer since I also have a GUI.
    - Turning to file events I now have the problem that the simulation
    cannot continue before a particular call to the hardware is complete:
    It may ask the hardware for a particular value which is to be used in
    the next command.

    So my question is: How do I block execution of the simulation part
    until an answer arrives /without/ blocking the whole app?
    - An attempt to use 'vwait' resulted in the whole app freezing.
    - A separate thread would probably solve this problem.
    - A coroutine would instinctively be a "lighter" solution but I have
    so far never used coroutines and didn't find an example which seemed
    to "fit" my situation.
    - Any other way ...

    Any idea, tip or link will be greatly appreciated
    Helmut
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Helmut Giese@hgiese@ratiosoft.com to comp.arch.embedded on Tue Feb 27 22:30:15 2024
    From Newsgroup: comp.arch.embedded

    Sorry,
    wrong news group.
    Helmut
    --- Synchronet 3.20a-Linux NewsLink 1.114