summaryrefslogtreecommitdiff
path: root/demo/cleanup.py
diff options
context:
space:
mode:
Diffstat (limited to 'demo/cleanup.py')
-rwxr-xr-xdemo/cleanup.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/demo/cleanup.py b/demo/cleanup.py
new file mode 100755
index 0000000..afe4178
--- /dev/null
+++ b/demo/cleanup.py
@@ -0,0 +1,22 @@
+import posix_ipc
+import utils
+
+params = utils.read_params()
+
+try:
+ posix_ipc.unlink_shared_memory(params["SHARED_MEMORY_NAME"])
+ s = "memory segment %s removed" % params["SHARED_MEMORY_NAME"]
+ print (s)
+except:
+ print ("memory doesn't need cleanup")
+
+
+try:
+ posix_ipc.unlink_semaphore(params["SEMAPHORE_NAME"])
+ s = "semaphore %s removed" % params["SEMAPHORE_NAME"]
+ print (s)
+except:
+ print ("semaphore doesn't need cleanup")
+
+
+print ("\nAll clean!")