summaryrefslogtreecommitdiff
path: root/thread_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'thread_utils.py')
-rw-r--r--thread_utils.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/thread_utils.py b/thread_utils.py
index 01755de..5903782 100644
--- a/thread_utils.py
+++ b/thread_utils.py
@@ -72,7 +72,7 @@ def background_thread(
*** event as an input parameter and should periodically check ***
*** it and stop if the event is set. ***
- Usage:
+ Usage::
@background_thread
def random(a: int, b: str, stop_event: threading.Event) -> None:
@@ -82,7 +82,6 @@ def background_thread(
if stop_event.is_set():
return
-
def main() -> None:
(thread, event) = random(22, "dude")
print("back!")
@@ -131,13 +130,12 @@ def periodically_invoke(
Returns a Thread object and an Event that, when signaled, will stop
the invocations. Note that it is possible to be invoked one time
after the Event is set. This event can be used to stop infinite
- invocation style or finite invocation style decorations.
+ invocation style or finite invocation style decorations.::
@periodically_invoke(period_sec=0.5, stop_after=None)
def there(name: str, age: int) -> None:
print(f" ...there {name}, {age}")
-
@periodically_invoke(period_sec=1.0, stop_after=3)
def hello(name: str) -> None:
print(f"Hello, {name}")