I writing a program with the aim of real-time and low-latency data processing that have multiple tasks running on a single thread. For two of those tasks, let’s call them A
and B
, I need a very tight synchronization on scheduler. If task A performs certain operation, it puts a data into the c::Channel
and yield()
. Task B
is already running and always wait for incoming data from c::Channel
in the line with take!(c)
. I need task B
to be scheduled as next just after task A
yields.
For visualization, when A
puts data into channel, I am getting tasks executed by scheduler in the following order: A
, C
, D
, E
, F
, B
. There are always tasks run between A
and B
. I need the order to look like this: A
, B
, …
Is it possible to achieve such behavior in Julia?
From the docs, functions yield(t::Task)
and yieldto(t::Task)
looked promising, but I can not successfully use them.
I am running x86_64 Linux (Glibc) and Julia v1.11.1 if that matters.