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