summaryrefslogtreecommitdiffstats
path: root/pywrap/pcipywrap.c
diff options
context:
space:
mode:
authorVasilii Chernov <vchernov@inr.ru>2016-03-03 15:38:32 +0100
committerVasilii Chernov <vchernov@inr.ru>2016-03-03 15:38:32 +0100
commitc79d43273769d88f7129a3d53c80b85a6dc1946c (patch)
tree0b8071b6261d74ef8bdf50a029525546250369ed /pywrap/pcipywrap.c
parentee16e47966afe180d3c32e2b1d93301052894fac (diff)
downloadpcitool-c79d43273769d88f7129a3d53c80b85a6dc1946c.tar.gz
pcitool-c79d43273769d88f7129a3d53c80b85a6dc1946c.tar.bz2
pcitool-c79d43273769d88f7129a3d53c80b85a6dc1946c.tar.xz
pcitool-c79d43273769d88f7129a3d53c80b85a6dc1946c.zip
1. Pcipywrap: add persistent locking wrappings
2. html-server: - add scripts tab - change tab view to jQuery tabs
Diffstat (limited to 'pywrap/pcipywrap.c')
-rw-r--r--pywrap/pcipywrap.c43
1 files changed, 37 insertions, 6 deletions
diff --git a/pywrap/pcipywrap.c b/pywrap/pcipywrap.c
index cb99ce2..7431604 100644
--- a/pywrap/pcipywrap.c
+++ b/pywrap/pcipywrap.c
@@ -552,10 +552,10 @@ void pcipywrap_unlock_global(pcipywrap *self)
return;
}
-PyObject* pcipywrap_lock(pcipywrap *self, const char *lock_id)
+PyObject* lock(pcipywrap *self, const char *lock_id, pcilib_lock_flags_t flags)
{
pcilib_lock_t* lock = pcilib_get_lock(self->ctx,
- PCILIB_LOCK_FLAG_PERSISTENT,
+ flags,
lock_id);
if(!lock)
{
@@ -574,10 +574,21 @@ PyObject* pcipywrap_lock(pcipywrap *self, const char *lock_id)
return PyLong_FromLong((long)1);
}
-PyObject* pcipywrap_try_lock(pcipywrap *self, const char *lock_id)
+PyObject* pcipywrap_lock(pcipywrap *self, const char *lock_id)
+{
+ return lock(self, lock_id, PCILIB_LOCK_FLAGS_DEFAULT);
+}
+
+PyObject* pcipywrap_lock_persistent(pcipywrap *self, const char *lock_id)
+{
+ return lock(self, lock_id, PCILIB_LOCK_FLAG_PERSISTENT);
+}
+
+
+PyObject* try_lock(pcipywrap *self, const char *lock_id, pcilib_lock_flags_t flags)
{
pcilib_lock_t* lock = pcilib_get_lock(self->ctx,
- PCILIB_LOCK_FLAG_PERSISTENT,
+ flags,
lock_id);
if(!lock)
{
@@ -595,10 +606,20 @@ PyObject* pcipywrap_try_lock(pcipywrap *self, const char *lock_id)
return PyLong_FromLong((long)1);
}
-PyObject* pcipywrap_unlock(pcipywrap *self, const char *lock_id)
+PyObject* pcipywrap_try_lock(pcipywrap *self, const char *lock_id)
+{
+ return try_lock(self, lock_id, PCILIB_LOCK_FLAGS_DEFAULT);
+}
+
+PyObject* pcipywrap_try_lock_persistent(pcipywrap *self, const char *lock_id)
+{
+ return try_lock(self, lock_id, PCILIB_LOCK_FLAG_PERSISTENT);
+}
+
+PyObject* unlock(pcipywrap *self, const char *lock_id, pcilib_lock_flags_t flags)
{
pcilib_lock_t* lock = pcilib_get_lock(self->ctx,
- PCILIB_LOCK_FLAG_PERSISTENT,
+ flags,
lock_id);
if(!lock)
{
@@ -610,4 +631,14 @@ PyObject* pcipywrap_unlock(pcipywrap *self, const char *lock_id)
return PyLong_FromLong((long)1);
}
+PyObject* pcipywrap_unlock(pcipywrap *self, const char *lock_id)
+{
+ return unlock(self, lock_id, PCILIB_LOCK_FLAGS_DEFAULT);
+}
+
+PyObject* pcipywrap_unlock_persistent(pcipywrap *self, const char *lock_id)
+{
+ return unlock(self, lock_id, PCILIB_LOCK_FLAG_PERSISTENT);
+}
+