From cbd2111b4e5bfacc8c8262535d79df7073764e48 Mon Sep 17 00:00:00 2001 From: Alina Quereilhac Date: Tue, 24 May 2011 16:48:23 +0200 Subject: [PATCH] ns3 testbed small bugfix in the schedule_event --- src/nepi/testbeds/ns3/execute.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/nepi/testbeds/ns3/execute.py b/src/nepi/testbeds/ns3/execute.py index a9ccd370..b975b7fa 100644 --- a/src/nepi/testbeds/ns3/execute.py +++ b/src/nepi/testbeds/ns3/execute.py @@ -140,13 +140,15 @@ class TestbedController(testbed_impl.TestbedController): """Schedules event on running experiment""" def execute_event(condition, has_event_occurred, func, *args): # exec func - func(*args) - # flag event occured - has_event_occurred[0] = True - # notify condition indicating attribute was set - condition.acquire() - condition.notifyAll() - condition.release() + try: + func(*args) + finally: + # flag event occured + has_event_occurred[0] = True + # notify condition indicating attribute was set + condition.acquire() + condition.notifyAll() + condition.release() # contextId is defined as general context contextId = long(0xffffffff) @@ -163,9 +165,6 @@ class TestbedController(testbed_impl.TestbedController): while not has_event_occurred[0] and not self.ns3.Simulator.IsFinished(): condition.wait() condition.release() - if not has_event_occurred[0]: - raise RuntimeError('Event could not be scheduled : %s %s ' \ - % (repr(func), repr(args))) def _set_attribute(self, name, ns3_value, element): if self.status() == TESTBED_STATUS_STARTED: -- 2.47.0