Skip to content

Restore functionality of produce/consume #20927

@BenLauwens

Description

@BenLauwens

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! and put_and_take! functions are needed
  • SimJulia is a simulation framework and the end user writes functions that are automatically wrapped in a Task. A normal return (and not a produce(...)) of these functions means the end of the Task and the return value is injected as an Event 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 a put! command. This is very difficult to enforce as the framework builder and will lead to a lot of mistakes by the end users. So a return ... of a Task has to be injected automatically as the final value in the Channel.
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ioInvolving the I/O subsystem: libuv, read, write, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions