Concurrency: What's a channel?
I'm studying pascal-fc for a concurrency test.
I'm开发者_运维百科 familiar with Java's threads and its monitors.
I don't understand the role of channels, please explain.
A channel is a kind of object that links a receiver and a sender.
In Pascal-FC they are strongly typed: you have to declare what kind of object they allow to be sent and received. You can really imagine them as channels in the sense that a process opens a channel of integers
with another process: it will be able to send and receive integers
from that channel, and the other process too.
It's a communication device on which you can do mainly 2 operations:
send
, defined aschannel_var ! expression
receive
, defined aschannel_var ? variable
精彩评论