1
我正在Linux中使用信号量。我想知道信号值是否可以增加到初始值以外?如果是这样,那么什么时候会发生?信号量值大于初始化值
例如,信号量的值被初始化为1 如果我递增两次连续使用最多(SEM),将信号增量的超出1.
x(void){
sema_init(sem1, 1);
down(sem1);
{
.
. // some code implementation
.
}
up(sem1); // i understand this increment the value back to 1.
up(sem1);
/* what exactly does this statement do to the semaphore?
Will it increment the value to 2? If so what is the meaning of this statement? */
值}