hI
I have a question regarding semaphore.
code
module semaphore_ex;
semaphore sema; //declaring semaphore sema
initial begin
sema=new(4); //creating sema with '4' keys
fork
display("Process 1"); //process-1
display("Process 2"); //process-2
display("Process 3"); //process-3
display("Process 4"); //process-4
join
end
task automatic display(string str);
sema.get();
$display("%s",str);
sema.put();
sema.put();
endtask
endmodule
My question is if we use put two times, does the task get stuck because by definition put method is blocking or it actually increases the number of keys to 2 when you use an extra put and it does not behave as blocking?