Commit 442b8927 authored by Ontje Lünsdorf's avatar Ontje Lünsdorf
Browse files

Set default priority for convenience and set name attribute in initialize.

parent 9f6191db
...@@ -355,6 +355,7 @@ class Initialize(Event): ...@@ -355,6 +355,7 @@ class Initialize(Event):
"""Initializes a process.""" """Initializes a process."""
def __init__(self, env, process): def __init__(self, env, process):
self.env = env self.env = env
self.name = None
self.ok = True self.ok = True
self._value = None self._value = None
self.callbacks = [process._resume] self.callbacks = [process._resume]
...@@ -528,7 +529,7 @@ class Scheduler(object): ...@@ -528,7 +529,7 @@ class Scheduler(object):
self.queue = [] self.queue = []
self._eid = count() self._eid = count()
def schedule(self, event, priority, delay=0): def schedule(self, event, priority=DEFAULT_PRIORITY, delay=0):
"""Schedule an *event* with a given *priority* and a *delay*.""" """Schedule an *event* with a given *priority* and a *delay*."""
heappush(self.queue, (self.now + delay, priority, next(self._eid), heappush(self.queue, (self.now + delay, priority, next(self._eid),
event)) event))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment