正在复习多线程的sleeping barber问题,
wiki上给的答案,barber的线程如下:
while(true) { //runs in an infinite loop
P(Customers) //tries to acquire a customer - if none is available he goes
to sleep
P(accessSeats) //at this time he has been awakened - want to modify the
number of available seats
NumberOfFreeSeats++ //one chair gets free
V(Barber) //the barber is ready to cut
V(accessSeats) //we don't need the lock on the chairs anymore
//here the barber is cutting hair
}
其他背景信息可以在wiki上找到,我的问题是,V(Barbe