aboutsummaryrefslogtreecommitdiff
path: root/py11/mutex.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-09-20 17:51:01 -0400
committerRob Austein <sra@hactrn.net>2015-09-20 17:51:01 -0400
commit48f0c98b02ef77fa63d31a58341b07d07b6c47f6 (patch)
tree8affb1df901607dd2b48fe1d93876905cb168be3 /py11/mutex.py
parent91b051e349e3644b4a2114ec0366f8bd7d794f56 (diff)
Minimal documentation for py11.
Diffstat (limited to 'py11/mutex.py')
-rw-r--r--py11/mutex.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/py11/mutex.py b/py11/mutex.py
index 1d99aa1..f71e006 100644
--- a/py11/mutex.py
+++ b/py11/mutex.py
@@ -1,4 +1,25 @@
-# Optional mutex implementation.
+"""
+Optional Python mutex implementation for py11 library, using the
+threading.Lock primitive to provide the mutex itself.
+
+Most of the code in this module has to do with mapping between the
+Python and PKCS #11 APIs.
+
+If you just want locking, it's probably simpler to let the C code
+handle it, by passing CKF_OS_LOCKING_OK to C_Initialize().
+
+The main reason for having a complete implementation in Python is to
+test the API.
+
+Sample usage:
+
+ from p11 import *
+ from py11.mutex import MutexDB
+
+ p11 = PKCS11()
+ mdb = MutexDB()
+ p11.C_Initialize(0, mdb.create, mdb.destroy, mdb.lock, mdb.unlock)
+"""
from struct import pack, unpack
from .types import *