πŸ“˜ Channels in Perl 6

Perl 6 includes a number of solutions for parallel and concurrent calculations. The great thing is that this is already built-in into the language and no external libraries are required.

The idea of the channels is simple. You create a channel through which you can read and write. It is a kind of a pipe that can also easily transfer Perl 6 objects. If you are familiar with channels in, for example, Go, you would find Perl 6’s channels easily to understand.

In this section, we discuss the simplest applications of channels, where things happen in the same thread. The big thing about channels is that they transparently do the right thing if you’re sending in one or more threads, and receiving in another one or more threads. No value will be received by more than one thread, and no value shall be lost because of race conditions when sending them from more than one thread.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s