Search⌘ K

Message Passing

Explore message passing concurrency in D by learning how to send and receive typed messages between threads using send and receiveOnly. Understand thread communication through example programs where threads exchange int and double values. Discover how to handle multiple message parts with tuples and manage exceptions within worker threads. This lesson prepares you to implement robust concurrent message passing in advanced D programming.

We'll cover the following...

Message passing in D

send() sends messages and receiveOnly() waits for a message of a particular type. There are also prioritySend(), receive(), and receiveTimeout(), which will be explained later.

The owner in the following program sends its worker a message of type int and ...