def _on_network_changed(self, *args, **kwds): """Callback that is called by the SystemConfiguration framework when the network configuration has changed. This function runs in the context of the worker thread. """ from_thread.run(self._on_network_changed_main)
def _capture(): with PiCamera() as camera: camera.resolution = (640, 480) camera.framerate = 15 stream = io.BytesIO() for frame in camera.capture_continuous(stream, format="jpeg", use_video_port=True): from_thread.run(tx.send, (frame, stream.getvalue())) stream.seek(0)
def worker(a: int, b: int) -> int: assert threading.get_ident() != event_loop_thread_id return from_thread.run(add, a, b)
def worker() -> int: var.set(6) return from_thread.run(async_func)
def worker(*args: int) -> Literal[True]: from_thread.run(sleep, *args) return True
def worker(*args): from_thread.run(sleep, *args) return True