Hi everyone ,
I was trying out codes related to fine-grain process control .
process Main ;
initial begin
fork
begin:T1
wait ( Main != null ) ;
wait ( ( Main.status() inside { process::WAITING , process::FINISHED } ) );
$display("TIME:",$time," In thread T1");
end
begin:T2
wait ( Main != null ) ;
wait ( ( Main.status() inside { process::WAITING , process::FINISHED } ) );
$display("TIME:",$time," In thread T2");
end
begin:T3
Main = process::self();
$display("TIME:",$time," In thread T3");
#10 ; // Delay MAY be present !!
$display("TIME:",$time," After delay in thread T3");
end
join
$display("TIME:",$time," DONE !!"):
end
[Q] Any alternate solution possible ?
I though of using semaphores but the issue is Thread T3 could be replaced by anything ,
Threads T1 && T2 should start execution
(a) ONLY after thread T3 executes a delay statement OR
(b) thread T3 completes ( In case of No delay in T3 )