A return statement within the context of a fork...join statement is illegal and results in a compilation error.
SV also provides key words wait fork and disable fork keywords to wait for all the processes are completed for the executing the code after the wait fork. disable fork is to disable all the processes that are active and also the decendents of the processes.
One more advantage of SV is we can do Fine-grain process control i.e.,we can wait,kill,suspend,resume and know the state of a perticular process for individual processes.
LRM states:
A process is a built-in class that allows one process to access and control another process once it has started.
class process;
enum state { FINISHED, RUNNING, WAITING, SUSPENDED, KILLED };
static function process self();
function state status();
task kill();
task await();
task suspend();
task resume();
endclass
Objects of type process are created internally when processes are spawned. Users cannot create objects of type
process; attempts to call new shall not create a new process, and instead result in an error.
Call the 'self()' method of process class in the thread to be monitored and
then assign it to the process class object.
References:
SV LRM
following solvenet articles
https://solvnet.synopsys.com/retrieve/025657.html
https://solvnet.synopsys.com/retrieve/025656.html?otSearchResultSrc=advSearch&otSearchResultNumber=2&otPageNum=1