开发者

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 as channel_var ! expression
  • receive, defined as channel_var ? variable
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜