-
Hello again. I need some info on this one actually i don't quite understand the control flow when a user types 'exit'. I have actually a second thread running when using my open command to connect to a serial port. In the lamda of the Insert for that command i create a shared_ptr to the thread known outside and which survives the execution of the lambda then I open the port and the function executed in the thread gets the open serial port. I have as well a global exit flag ( could surely be done better but so far that shall be good enough ). I set the global flag to true in the ExitAction lamda but that is never seen by the reading thread .... ( the exit message in there just prints fine on the console ) so i must miss something .. esp also as it seems i never return from the CliFileSession input(cli); command. Any std::out print after the Start() never shows up ? Again something i miss for sure. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Actually I think I can add an exit action not only to cli but also to the session. That may actually do the trick. |
Beta Was this translation helpful? Give feedback.
-
The rationale for the exit actions is:
So, you can use Instead, when a user types "exit" on a remote telnet console, I guess you don't want the main application to shutdown! Instead, you might close the tasks started from that remote session. Finally, you can use See BTW: since the main thread of an asynchronous application is usually busy in the dispatching loop of a "scheduler" (e.g., |
Beta Was this translation helpful? Give feedback.
The rationale for the exit actions is:
CliLocalTerminalSession
exit action: it's called when the local session gets the "exit" command.CliTelnetServer
exit action: it's called whenever a remote session gets the "exit" command.Cli
exit action: it's called every time a session (local or remote) gets the "exit" command.So, you can use
CliLocalTerminalSession
exit action to shutdown the application (when you type "exit" in the local console, I guess you want your application to close.Instead, when a user types "exit" on a remote telnet console, I guess you don't want the main application to shutdown! Instead, you might close the tasks started from that remote session.
Finally, you can use