From 531d28ae2583e30c17ec7a0c911cde0343663244 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Fri, 15 Oct 2021 23:37:07 +0100 Subject: [PATCH] Improve documentation on start_background_task() function --- src/engineio/asyncio_client.py | 6 +----- src/engineio/client.py | 6 +++--- src/engineio/server.py | 6 +++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/engineio/asyncio_client.py b/src/engineio/asyncio_client.py index 930c8f5..1c5e95a 100644 --- a/src/engineio/asyncio_client.py +++ b/src/engineio/asyncio_client.py @@ -166,11 +166,7 @@ def start_background_task(self, target, *args, **kwargs): :param args: arguments to pass to the function. :param kwargs: keyword arguments to pass to the function. - This function returns an object compatible with the `Thread` class in - the Python standard library. The `start()` method on this object is - already called by this function. - - Note: this method is a coroutine. + The return value is a ``asyncio.Task`` object. """ return asyncio.ensure_future(target(*args, **kwargs)) diff --git a/src/engineio/client.py b/src/engineio/client.py index 16ac5b4..4516d46 100644 --- a/src/engineio/client.py +++ b/src/engineio/client.py @@ -241,9 +241,9 @@ def start_background_task(self, target, *args, **kwargs): :param args: arguments to pass to the function. :param kwargs: keyword arguments to pass to the function. - This function returns an object compatible with the `Thread` class in - the Python standard library. The `start()` method on this object is - already called by this function. + This function returns an object that represents the background task, + on which the ``join()`` method can be invoked to wait for the task to + complete. """ th = threading.Thread(target=target, args=args, kwargs=kwargs) th.start() diff --git a/src/engineio/server.py b/src/engineio/server.py index e99de41..e15ff5e 100644 --- a/src/engineio/server.py +++ b/src/engineio/server.py @@ -452,9 +452,9 @@ def start_background_task(self, target, *args, **kwargs): :param args: arguments to pass to the function. :param kwargs: keyword arguments to pass to the function. - This function returns an object compatible with the `Thread` class in - the Python standard library. The `start()` method on this object is - already called by this function. + This function returns an object that represents the background task, + on which the ``join()`` methond can be invoked to wait for the task to + complete. """ th = self._async['thread'](target=target, args=args, kwargs=kwargs) th.start()