-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Description
As already mentioned in pull request, Channels solve a particular form of intertask communication very elegantly but Tasks 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 SimJuliais 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 theTaskand the return value is injected as anEventin 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 aTaskhas to be injected automatically as the final value in theChannel.Channels 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