impr: Make CLI not hang for a second after each command on Linux
This commit is contained in:
parent
a83843fdab
commit
c39ae84922
@ -42,12 +42,18 @@ namespace hex::messaging {
|
|||||||
|
|
||||||
static auto listenerThread = std::jthread([](const std::stop_token &stopToken){
|
static auto listenerThread = std::jthread([](const std::stop_token &stopToken){
|
||||||
std::vector<u8> buffer(0xFFFF);
|
std::vector<u8> buffer(0xFFFF);
|
||||||
while (!stopToken.stop_requested()) {
|
|
||||||
|
while (true) {
|
||||||
int result = ::read(fifo, buffer.data(), buffer.size());
|
int result = ::read(fifo, buffer.data(), buffer.size());
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
EventNativeMessageReceived::post(std::vector<u8>{ buffer.begin(), buffer.begin() + result });
|
EventNativeMessageReceived::post(std::vector<u8>{ buffer.begin(), buffer.begin() + result });
|
||||||
} else {
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
|
||||||
|
if (stopToken.stop_requested())
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (result <= 0) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user