c++command-line-tool

How exit replxx using SigInt from another thread


I use replxx as modern command-line tool. I found example but in this example there is only one thread. I make separated thread for replxx, from main thread I want ask replxx to exit... How do it?

I already have founded similar topic, this is also about multithreading but about another feature, I want to exit..


Solution

  • Solution here. From main thread ask replxx's thread to exit using

    consoleWorker->rx.emulate_key_press(Replxx::KEY::control( 'C' ));
    

    In my code consoleWorker is object from replxx's thread and rx is Replxx object themself. There is my full-code replxx multithreading example.