-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
As already mentioned in pull request, Channel
s solve a particular form of intertask communication very elegantly but Task
s are also used for other use cases and they are not well served by the concept of a Channel
.
SimJulia is a heavy user of the deprecated Task
switching facilities consume
and produce
:
- atomic
take_and_put!
andput_and_take!
functions are needed SimJulia
is a simulation framework and the end user writes functions that are automatically wrapped in aTask
. A normalreturn
(and not aproduce(...)
) of these functions means the end of theTask
and the return value is injected as anEvent
in the simulation. With the old behaviour the end user is free to organise his/her code as he/she likes; the new implementation forces the end user to never return his function but always use aput!
command. This is very difficult to enforce as the framework builder and will lead to a lot of mistakes by the end users. So areturn ...
of aTask
has to be injected automatically as the final value in theChannel
.Channel
s with no buffer (as needed by a synchronised simulation) are awfully slow.
I have created my own consume
and produce
functions but I am quite sure that they will stop working once the field consumers
of Task
will be removed.
So my initial question remains why deprecating something that is very useful and can not be replaced with the new way of doing things. I understand that having a One True Inter-Task Communication method is the way to go but I have the feeling that we are throwing the baby out with the bath water.
Ben