Skip to content

Commit

Permalink
make sure that _ExtCallbackObject's always have an ordering (should fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdejong committed Jan 29, 2019
1 parent 416303e commit 7dba62b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions horizons/extscheduler.py
Expand Up @@ -43,6 +43,12 @@ def __init__(self, callback, class_instance, run_in=1, loops=1):
def __str__(self):
return "ExtSchedCb(%s on %s)" % (self.callback, self.class_instance)

def __lt__(self, other):
# make sure that there is always some ordering
if self.run_in < other.run_in:
return True
return id(self) < id(other)


class ExtScheduler(object, metaclass=ManualConstructionSingleton):
"""The ExtScheduler is used for time based events that are not part of the simulation(gui, menu, scrolling).
Expand Down

0 comments on commit 7dba62b

Please sign in to comment.