Exemplo n.º 1
0
    def verify_priority(self):
        if Bridge.bridge().bridge_priority != Priority.NONE:
            if self.car_direction != Bridge.bridge().bridge_priority:
                if Bridge.bridge_priority_semaphore._value == 0:
                    Bridge.bridge_priority_semaphore.acquire()

            else:
                if Bridge.bridge_priority_semaphore._value == 1:
                    Bridge.bridge_priority_semaphore.acquire()
Exemplo n.º 2
0
 def free_bridge_from_priority(self):
     if Bridge.bridge().bridge_priority != Priority.NONE:
         if self.car_direction == Bridge.bridge().bridge_priority:
             if Bridge.bridge_priority_semaphore._value == 0:
                 Bridge.bridge_priority_semaphore.release()