You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The expected behavior is that the task submitted after 0.5s should be executed before the task submitted after 1s. However, the actual output suggests otherwise: (Some output logs are added inside concurrencpp lib for convenience)
[2023-09-11 21:35:22.066] [info] co_main start
enqueue
enqueue foreign
[2023-09-11 21:35:22.067] [info] co_main posted sleeper
task begin
[2023-09-11 21:35:22.067] [info] >>> sleeper start
[2023-09-11 21:35:22.567] [info] co_main ready: enqueueing ">>> scheduled" // <-- first enqueued
enqueue
enqueue foreign
[2023-09-11 21:35:23.067] [info] >>> sleeper awake: enqueueing ">>> notify "
enqueue
enqueue local
task end
task begin
[2023-09-11 21:35:23.067] [info] >>> notify
[2023-09-11 21:35:24.067] [info] >>> sleeper return
task end
task begin
[2023-09-11 21:35:24.067] [info] >>> scheduled // <-- but not first executed
[2023-09-11 21:35:24.067] [info] co_main notified
task end
Process finished with exit code 0
The issue is that the task submitted after 0.5s is actually executed after the task submitted after 1s, which contradicts my expectations.
This is caused by the private-public dual task queue inside worker_thread_executor. I would appreciate any insights on this design, rather than what is claimed in the docs:
worker thread executor - a single thread executor that maintains a single task queue. Suitable when applications want a dedicated thread that executes many related tasks.
The text was updated successfully, but these errors were encountered:
Description:
I encountered a task scheduling issue while using the concurrencpp library. The following is a test code snippet that demonstrates the problem:
The expected behavior is that the task submitted after 0.5s should be executed before the task submitted after 1s. However, the actual output suggests otherwise: (Some output logs are added inside concurrencpp lib for convenience)
The issue is that the task submitted after 0.5s is actually executed after the task submitted after 1s, which contradicts my expectations.
This is caused by the private-public dual task queue inside worker_thread_executor. I would appreciate any insights on this design, rather than what is claimed in the docs:
The text was updated successfully, but these errors were encountered: