Five parallel thread are running after successfully execution of three i want to kill/disable rest two thread

In reply to Raghunandan Reddy:

Using a semaphore implies potentially blocking threads. That is as good as time-consuming to solve the problem.
In reply to ledzep_1988:

Let’s say count is 2, and there are two processes scheduled to increment count at the same time. The first process increments count from 2 to 3. That schedules the process waiting for a change on count to wake up and evaluate its wait expression. SystemVerilog does not guarantee the order of process evaluation so it’s possible that the other process increments count to 4 before wait expression gets evaluated.