June 2019
Intermediate to advanced
218 pages
5h 19m
English
When multiple tasks are running simultaneously, it is useful sometimes to be able to communicate data and state between them. A Channel is a Julia object that can be used to asynchronously send data from one task to another. A Channel is created by specifying the type of object it can contain, and a maximum number of elements it can hold. If no type is specified, Any is used. A maximum value of 0 implies that the channel can hold an unlimited number of values.
The following code snippet shows how to create a channel:
julia> c = Channel{Int}(10)Channel{Int64}(sz_max:10,sz_curr:0)
A channel should be viewed as a pipe, with data entering at one end, and being consumed at the other. Values are sent to the channel using ...
Read now
Unlock full access