开发者

Concurrency: What's a channel?

开发者 https://www.devze.com 2022-12-29 12:35 出处:网络
I\'m studying pascal-fc for a concurrency test. I\'m开发者_运维百科 familiar with Java\'s threads and its monitors.

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

精彩评论

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

关注公众号