- Using
result := expression
notation will initiate a new parallel task (green thread) as a child of the current task. Any access to the resultresult
will block current process until the child is finished. - You can call core function to create a channel. Channels can be used for communication and synchronization across tasks.
- A channel is represented via a generic struct with functions to read/write data (Example A).
- Other operations like
select
will be decided later.
Examples
_ := process(10, 20)
channel = createChannel(int, 10)
#pass channel to a task
int_result := process(10, channel)
#write data into the channel (blocks if channel is full)
channel.write(100)
#read data from channel (blocks if there is nothing to read)
data = channel.read()