Working of "wait fork" construct in system verilog

In reply to kuki2002:

I’m not sure I understand your question. There is no module in the example. There is a program block that waits for all initial blocks to finish. timeout_fork is a fork/join_any block that waits for any statement inside the fork to finish. The #5; statement is the first to finish, so that makes the task consume_time return and its initial block finish.