Can a thread use multiple semaphore keys?
semaphore a=new(2);
module testbench();
initial begin: thread_1
#10;
a.get(1);
$display($time,"thread 1 got the key");
a.put(1);
$display($time,"thread 1 put the key");
end
initial begin: thread_2
a.get(2);
$display($time,"thread 2 got the key");
a.get(1);
a.put(1);
end
endmodule: testbench
OUTPUT:
0 Thread 2 got the key.
if thread 2 happens in time 0 why isn’t the taken keys are not used in the thread 1 even if the thread 2 put both keys into the semaphore