Mailbox

In reply to Shashank Gurijala:

A couple of other comments about your example code

  1. Technically, using class handle (mbx) where numeric expression is expected in $display should have been a run time error.
  2. You should always parameterize your mailbox with the type you expect to put into it.
mailbox #(int) mbx;
  1. You have a fork/join block with one begin/end statement. That behaves the same has having a begin/end block with no fork/join.
  2. Declare your for loop iterator variables as part of the loop statement. That helps it local and avoid potential collisions between different loops executing concurrently.
for (int i=1;i<=5;i++)

  1. Please use code tags making your code easier to read. I have added them for you.