Replies: 6 comments 6 replies
-
First of all, thank you for using As far as concern your problem: I need to know:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply. As for your questions,
Here is the code I run the test, with
|
Beta Was this translation helpful? Give feedback.
-
I might find the problem, It's because the work_guard only exist in the scheduler.Run(), and the underlying boost::asio::run_one always return because there's no outstanding work, so the solution would be to put the work_guard as a member variable besides the io_context?
I've tested this code, it's working fine on both Windows and Linux, I only added a work_guard before executing the scheduler.ExecOne();
|
Beta Was this translation helpful? Give feedback.
-
And for the LoopScheduler, removed the condition_variable and added a
|
Beta Was this translation helpful? Give feedback.
-
Yes, I guess you found the root cause of the problem.
|
Beta Was this translation helpful? Give feedback.
-
@hanyukang |
Beta Was this translation helpful? Give feedback.
-
Hi,
This may be a silly question, but I'm stuck in this for a while and need some help.
I put the scheduler in the main thread because my callbacks use quite a lot of variables which only the main thread is in charge of updating them. The main thread can't be blocked as other modules need to update as well. I try to use
ExecOne()
in theScheduler_Run()
but the terminal seems to block the keyboard input as I can't type anything on it.This happened only in Linux build, the Windows build was working fine...
Not sure if I'm using this lib correctly, the code looks like this,
Beta Was this translation helpful? Give feedback.
All reactions