Detailed Correct Answers Graded A+
(1) Please complete the following function for readShouldWait(). bool RWLock::readShouldWait() {
return ( activeWriters>0 || _________________ ); - correct answers waitingWriters > 0
(2) Please complete the following function for startWrite().
bool RWLock:: startWrite() {
lock.acquire();
___________________++;
while(___________________) {
___________________.wait(&lock)
}
activeWriters++;
lock.release();
} - correct answers waitingWriters
writeShouldWait()
writeGo
waitingWriters--;
(3) Please complete the following function for doneRead(). bool RWLock:: doneRead() {
lock.acquire();
_________________;
if( _________________ && waitingWriters>0) writeGo.signal(&lock); lock.release(); } - correct answers
activeReaders--
activeReaders == 0