Comments (2)
Actually while attempting to fix this, I realized that this won't be a very holistic solution.
https://github.com/sakshamsharma/cli/commits/plugin
Well, it works. But only for local sessions.
Basically, any such approach will be helpless when it comes to network data on boost sockets. It appears that boost does not take kindly to other dispatchers trying to do its job ( :sad: ).
Until then, I have adopted a different approach for this, where I launch one thread with an ios.run()
, and I made my CmdHandler lambdas (running in the boost dispatcher thread) push lambdas into my own select based dispatcher.
from cli.
First of all, are you sure boost asio can’t manage file descriptors? Take a look at this page:
https://www.boost.org/doc/libs/1_72_0/doc/html/boost_asio/overview/posix/stream_descriptor.html
Sorry, but I can’t understand the problem you’re trying to solve in the first place.
Cli handlers all run in the thread that invokes run() on the io_service passed on the cli constructor.
If your application runs in other threads, than you simply needs a way to communicate from one thread to the other.
The right way depends on how works your threads. You wrote that your application has got a dispatcher, so I guess you have a way to send events to it: eg if sending events is an atomic operation / is synchronized, you can safely send events from cli handlers to your dispatcher.
How to reach your dispatcher is another problem again. If you have just one in all the application, you can use the singleton pattern to get the unique instance from inside the cli handlers.
from cli.
Related Issues (20)
- Differentiate features in vcpkg
- Backspace is not working in MobaXterm HOT 5
- Add CSIu extensions a la libtermkey [issue from reddit]
- How to use ExecOne in main thread without blocking?
- Add a non-blocking exec method to schedulers
- Bug instantiating Local terminal sessions in multiple threads HOT 6
- Do not show 'cli' prompt on main thread HOT 1
- Redirect log output to connected session.
- Custom help command.
- Can't pass vectors arguments such as `std::vector<std::string>` to commands in v2.0 HOT 3
- Compile error with ARM processor when using telnet server HOT 2
- Add new keystroke / shortcut bash style
- CliSession can call OutStream::UnRegister() when it's already destroyed
- Is there any way to list files in the current directory with double clicking TAB?
- Parameter of type "file" (or "directory") with autocompletion
- get the help message of a sub menu by just calling <submenu name> + help
- Conflicting namespaces with aff3ct HOT 2
- Coredump in `cli::detail::Session::Disconnect()` HOT 3
- Feature EnterAction HOT 4
- HOME and END does not work properly in tmux. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.