void female(void *p, unsigned long which) { struct semaphore * whalematingMenuSemaphore = (struct semaphore *)p; (void)which; female_start(); // Implement this function lock_acquire(whaleLock); // Implement this function if (wchan_isempty(maleCv->cv_wchan) || wchan_isempty(matchMakerCv->cv_wchan)) { cv_wait(femaleCv,whaleLock); }else{ cv_signal(maleCv,whaleLock); cv_signal(matchMakerCv,whaleLock); } lock_release(whaleLock); female_end(); // 08 Feb 2012 : GWA : Please do not change this code. This is so that your // whalemating driver can return to the menu cleanly. V(whalematingMenuSemaphore); return; }
void female(void *p, unsigned long which) { struct semaphore * whalematingMenuSemaphore = (struct semaphore *)p; (void)which; female_start(); V(femalesem); //P(malesem); P(testsem2); /* V(testsem); V(testsem); V(testsem); P(testsem); V(testsem); V(testsem2); V(testsem2); V(testsem2); P(testsem2); */ female_end(); /*V(testsem2); */ //V(matchmakersem); //V(malesem); // 08 Feb 2012 : GWA : Please do not change this code. This is so that your // whalemating driver can return to the menu cleanly. V(whalematingMenuSemaphore); return; }
void female(void *p, unsigned long which) { struct semaphore * whalematingMenuSemaphore = (struct semaphore *)p; (void)which; female_start(); kprintf("SStarting Female %lu\n",which); lock_acquire(wm_lock); females++; cv_signal(wm_mmcv,wm_lock); cv_wait(wm_mcv,wm_lock); kprintf("Releasing Female"); lock_release(wm_lock); female_end(); // 08 Feb 2012 : GWA : Please do not change this code. This is so that your // whalemating driver can return to the menu cleanly. V(whalematingMenuSemaphore); return; }
void female(void *p, unsigned long which) { struct semaphore * whalematingMenuSemaphore = (struct semaphore *)p; (void)which; female_start(); lock_acquire(hold); V(female_sem); female_count++; if(male_count!=0) cv_signal(mate_cv,hold); else cv_wait(mate_cv,hold); lock_release(hold); // Implement this function female_end(); // 08 Feb 2012 : GWA : Please do not change this code. This is so that your // whalemating driver can return to the menu cleanly. V(whalematingMenuSemaphore); return; }