Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 def worker(a: int, b: int) -> int:
     assert threading.get_ident() != event_loop_thread_id
     return from_thread.run(add, a, b)
Ejemplo n.º 4
0
 def worker() -> int:
     var.set(6)
     return from_thread.run(async_func)
Ejemplo n.º 5
0
 def worker(*args: int) -> Literal[True]:
     from_thread.run(sleep, *args)
     return True
Ejemplo n.º 6
0
 def worker(*args):
     from_thread.run(sleep, *args)
     return True