summaryrefslogtreecommitdiff
path: root/examples/async_printing.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-15 15:00:59 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2019-06-15 15:00:59 -0400
commit70bf9e1a12b89bb913c11fb07893ab4b9cab2576 (patch)
tree27bb62898d635bcaa8e6e8182d52f5105210b3f6 /examples/async_printing.py
parentc12ba0ff11b3a8fd083c641cb9149aff6494bbf9 (diff)
downloadcmd2-git-70bf9e1a12b89bb913c11fb07893ab4b9cab2576.tar.gz
Began work to minimize public API
Diffstat (limited to 'examples/async_printing.py')
-rwxr-xr-xexamples/async_printing.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/async_printing.py b/examples/async_printing.py
index 3089070f..b59d3d6d 100755
--- a/examples/async_printing.py
+++ b/examples/async_printing.py
@@ -48,7 +48,7 @@ class AlerterApp(cmd2.Cmd):
def _preloop_hook(self) -> None:
""" Start the alerter thread """
- # This runs after cmdloop() acquires self.terminal_lock, which will be locked until the prompt appears.
+ # This runs after cmdloop() acquires self._terminal_lock, which will be locked until the prompt appears.
# Therefore this is the best place to start the alerter thread since there is no risk of it alerting
# before the prompt is displayed. You can also start it via a command if its not something that should
# be running during the entire application. See do_start_alerts().
@@ -60,7 +60,7 @@ class AlerterApp(cmd2.Cmd):
def _postloop_hook(self) -> None:
""" Stops the alerter thread """
- # After this function returns, cmdloop() releases self.terminal_lock which could make the alerter
+ # After this function returns, cmdloop() releases self._terminal_lock which could make the alerter
# thread think the prompt is on screen. Therefore this is the best place to stop the alerter thread.
# You can also stop it via a command. See do_stop_alerts().
self._stop_thread = True
@@ -169,9 +169,9 @@ class AlerterApp(cmd2.Cmd):
self._next_alert_time = 0
while not self._stop_thread:
- # Always acquire terminal_lock before printing alerts or updating the prompt
+ # Always acquire _terminal_lock before printing alerts or updating the prompt
# To keep the app responsive, do not block on this call
- if self.terminal_lock.acquire(blocking=False):
+ if self._terminal_lock.acquire(blocking=False):
# Get any alerts that need to be printed
alert_str = self._generate_alert_str()
@@ -191,7 +191,7 @@ class AlerterApp(cmd2.Cmd):
self.async_update_prompt(new_prompt)
# Don't forget to release the lock
- self.terminal_lock.release()
+ self._terminal_lock.release()
time.sleep(0.5)