Skip to content

Commit a8b1163

Browse files
committed
Fix sentance, clarify has_events, no behavioral change
1 parent ee4822a commit a8b1163

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

design/mvp/CanonicalABI.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ flag to block new tasks from starting or resuming.
579579
While a task is running, it may call `wait` (via `canon task.wait` or when
580580
using a `callback`, by returning to the event loop) to learn about progress
581581
made by async subtasks, streams or futures which are reported to this task by
582-
`notify`.Queue`. (The definition of `wait_on`, used by `wait` here, is next.)
582+
`notify`. (The definition of `wait_on`, used by `wait` here, is next.)
583583
```python
584584
async def wait(self, sync) -> EventTuple:
585585
while True:
@@ -589,10 +589,12 @@ made by async subtasks, streams or futures which are reported to this task by
589589

590590
def maybe_next_event(self) -> Optional[EventTuple]:
591591
while self.events:
592+
assert(self.has_events.is_set())
592593
event = self.events.pop(0)
594+
if not self.events:
595+
self.has_events.clear()
593596
if (e := event()):
594597
return e
595-
self.has_events.clear()
596598
return None
597599

598600
def notify(self, event: EventCallback):

design/mvp/canonical-abi/definitions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,12 @@ async def wait(self, sync) -> EventTuple:
451451

452452
def maybe_next_event(self) -> Optional[EventTuple]:
453453
while self.events:
454+
assert(self.has_events.is_set())
454455
event = self.events.pop(0)
456+
if not self.events:
457+
self.has_events.clear()
455458
if (e := event()):
456459
return e
457-
self.has_events.clear()
458460
return None
459461

460462
def notify(self, event: EventCallback):

0 commit comments

Comments
 (0)