Python3 Updates
This commit is contained in:
parent
190a70532a
commit
50164a92c6
7 changed files with 26 additions and 10 deletions
|
|
@ -16,6 +16,9 @@
|
|||
import pypdevs.accurate_time as time
|
||||
from threading import Lock
|
||||
|
||||
_GLLOCK = Lock()
|
||||
|
||||
|
||||
class ThreadingGameLoop(object):
|
||||
"""
|
||||
Game loop subsystem for realtime simulation. Time will only progress when a *step* call is made.
|
||||
|
|
@ -30,9 +33,10 @@ class ThreadingGameLoop(object):
|
|||
"""
|
||||
Perform a step in the simulation. Actual processing is done in a seperate thread.
|
||||
"""
|
||||
if time.time() >= self.next_event:
|
||||
self.next_event = float('inf')
|
||||
getattr(self, "func")()
|
||||
with _GLLOCK: # Thread-safety
|
||||
if time.time() >= self.next_event:
|
||||
self.next_event = float('inf')
|
||||
getattr(self, "func")()
|
||||
|
||||
def wait(self, delay, func):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -144,7 +144,9 @@ class DEVSException(Exception):
|
|||
"""
|
||||
String representation of the exception
|
||||
"""
|
||||
return "DEVS Exception: " + str(self.message)
|
||||
if hasattr(self, "message"):
|
||||
return "DEVS Exception: " + str(self.message)
|
||||
return "DEVS Exception: " + str(self.args[0])
|
||||
|
||||
class QuickStopException(Exception):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue