Fork join

In reply to diptishe:

Because your task has a static lifetime, the arguments have static lifetimes as well. That means there is only one space allocated for the arguments for all concurrent invocations of the tasks. You need to declare the task with an automatic lifetime, making it reentrant.

task automatic display (int _time, string t_name);

Tasked defined in classes do not have this problem since they always have automatic lifetimes.