Are messages sent to self() immediately received?

receive won’t block and wait when used with after 0 -> ….

I know, but that’s a special case. receive is a blocking call generally, and even in case of after 0 it blocks, checks the queue for matching messages and continues with either matched message or after clause.

What I wanted to say, is to think receive is where you can create guarantee that you’ll receive message.

1 Like

Sorry for replying late on this. It is the BEAM itself which handles taking the message and copying it to the receiving processes heap and putting it on the message queue. This can be done in different ways.

1 Like