In reply to NaveenReddy:
There really is no difference in terms of potential to hang if you put the code in a task or not.
It’s up to you to decide if using the task makes your code more readable. If this is a method of a class, putting it in a task makes it easier t override.
BTW, I recommend that you keep things synchronized by only using a clock edge and not using wait statements. Use
@(posedge m_vif.uclk iff xyz[i] == 1)