Skip to content

Commit

Permalink
Improve documentation on start_background_task() function
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Oct 15, 2021
1 parent 72b7136 commit 531d28a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/engineio/asyncio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
6 changes: 3 additions & 3 deletions src/engineio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions src/engineio/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 531d28a

Please sign in to comment.