diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-04-13 13:12:46 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-04-13 13:20:13 -0400 |
commit | 1592395036677f4c5959d947bac62a419134600b (patch) | |
tree | 266fb3fdaa08a4505b75b1b5e1c57148a84b4fef | |
parent | 8491b1f86a189f94ca5fe6f59f17bf99af0784b6 (diff) | |
download | kutter-1592395036677f4c5959d947bac62a419134600b.tar.gz kutter-1592395036677f4c5959d947bac62a419134600b.tar.xz kutter-1592395036677f4c5959d947bac62a419134600b.zip |
reactor: Fix bug causing end() to not always work
Only set the self._process flag in run() not _dispatch_loop().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | klippy/reactor.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/klippy/reactor.py b/klippy/reactor.py index 65536616..9bce6a9b 100644 --- a/klippy/reactor.py +++ b/klippy/reactor.py @@ -1,6 +1,6 @@ # File descriptor and timer event helper # -# Copyright (C) 2016 Kevin O'Connor <kevin@koconnor.net> +# Copyright (C) 2016,2017 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. import select, math, time @@ -105,7 +105,6 @@ class SelectReactor: self._fds.pop(self._fds.index(handler)) # Main loop def _dispatch_loop(self): - self._process = True self._g_dispatch = g_dispatch = greenlet.getcurrent() eventtime = self.monotonic() while self._process: @@ -120,6 +119,7 @@ class SelectReactor: break self._g_dispatch = None def run(self): + self._process = True g_next = ReactorGreenlet(run=self._dispatch_loop) g_next.switch() def end(self): @@ -145,7 +145,6 @@ class PollReactor(SelectReactor): self._fds = fds # Main loop def _dispatch_loop(self): - self._process = True self._g_dispatch = g_dispatch = greenlet.getcurrent() eventtime = self.monotonic() while self._process: @@ -180,7 +179,6 @@ class EPollReactor(SelectReactor): self._fds = fds # Main loop def _dispatch_loop(self): - self._process = True self._g_dispatch = g_dispatch = greenlet.getcurrent() eventtime = self.monotonic() while self._process: |