Embedded task scheduler using threading.
| 1105 | |
| 1106 | |
| 1107 | class _Threaded(Thread): |
| 1108 | """Embedded task scheduler using threading.""" |
| 1109 | |
| 1110 | def __init__(self, app, **kwargs): |
| 1111 | super().__init__() |
| 1112 | self.app = app |
| 1113 | self.service = Service(app, **kwargs) |
| 1114 | self.daemon = True |
| 1115 | self.name = 'Beat' |
| 1116 | |
| 1117 | def run(self): |
| 1118 | self.app.set_current() |
| 1119 | self.service.start() |
| 1120 | |
| 1121 | def stop(self): |
| 1122 | self.service.stop(wait=True) |
| 1123 | |
| 1124 | |
| 1125 | try: |