not running
Embed:
(wiki syntax)
Show/hide line numbers
Intersection.cpp
00001 #include "Intersection.h" 00002 00003 void Intersection::add_to_q(AccCar* car) { 00004 qmutex.lock(); 00005 crossQ.push(car); 00006 qmutex.unlock(); 00007 } 00008 00009 void Intersection::remove_from_q() { 00010 qmutex.lock(); 00011 crossQ.pop(); 00012 qmutex.unlock(); 00013 } 00014 00015 bool Intersection::can_cross(AccCar* car) { 00016 // FCFS 00017 qmutex.lock(); 00018 if(crossQ.front() == car) { 00019 qmutex.unlock(); 00020 return true; 00021 } 00022 qmutex.unlock(); 00023 return false; 00024 }
Generated on Fri Jul 22 2022 13:26:47 by
1.7.2