summaryrefslogtreecommitdiff
path: root/demo4/ReadMe.txt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-02-21 04:46:49 +0000
committer <>2014-08-04 21:38:17 +0000
commitf3765db04b903b3671733e07cf1541a51966dd14 (patch)
treedefcc3c47d9b8bd78b97dcc04ee779a758d37b1c /demo4/ReadMe.txt
downloadposix-ipc-tarball-master.tar.gz
Imported from /home/lorry/working-area/delta_python-packages_posix-ipc-tarball/posix_ipc-0.9.8.tar.gz.HEADposix_ipc-0.9.8master
Diffstat (limited to 'demo4/ReadMe.txt')
-rw-r--r--demo4/ReadMe.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/demo4/ReadMe.txt b/demo4/ReadMe.txt
new file mode 100644
index 0000000..25f73e9
--- /dev/null
+++ b/demo4/ReadMe.txt
@@ -0,0 +1,15 @@
+This demonstrates the use of a semaphore with a Python context manager (a
+'with' statement).
+
+To run the demo, simply run `python parent.py`. It launches child.py.
+
+The programs parent.py and child.py share a semaphore; the latter acquires the
+semaphore via a context manager. The child process deliberately kills itself via
+an error about half the time (randomly) in order to demonstrate that the
+context manager releases the semaphore regardless of whether or not the context
+block is exited gracefully.
+
+Once the child releases the semaphore, the parent destroys it.
+
+The whole thing happens in less than 10 seconds.
+