In reply to Shashank Gurijala:
A couple of other comments about your example code
- Technically, using class handle (mbx) where numeric expression is expected in $display should have been a run time error.
- You should always parameterize your mailbox with the type you expect to put into it.
mailbox #(int) mbx;
- 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.
- 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++)
- Please use code tags making your code easier to read. I have added them for you.