From 48f0c98b02ef77fa63d31a58341b07d07b6c47f6 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 20 Sep 2015 17:51:01 -0400 Subject: Minimal documentation for py11. --- py11/mutex.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'py11/mutex.py') 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 * -- cgit v1.2.3