Prove scritte 2011
Jump to navigation
Jump to search
Esame 11/05/2011
Esercizio 2 (da controllare)
stack s;
semaphore mutex(1);
lifocs_enter()
{
s.push(getpid());
mutex.p();
while(s.lastElement() != getpid())
{
mutex.v();
mutex.p();
}
s.pop();
}
lifocs_exit()
{
mutex.v();
}