dataman: add dm_trylock & add lock for FENCE_POINTS items

This commit is contained in:
Beat Küng
2017-08-04 18:08:51 +02:00
committed by Lorenz Meier
parent 1942641ff6
commit 72501df88e
2 changed files with 59 additions and 15 deletions
+19 -5
View File
@@ -127,16 +127,30 @@ dm_write(
size_t buflen /* Length in bytes of data to retrieve */
);
/** Lock all items of this type */
__EXPORT void
/**
* Lock all items of a type. Can be used for atomic updates of multiple items (single items are always updated
* atomically).
* Note that this lock is independent from dm_read & dm_write calls.
* @return 0 on success and lock taken, -1 on error (lock not taken, errno set)
*/
__EXPORT int
dm_lock(
dm_item_t item /* The item type to clear */
dm_item_t item /* The item type to lock */
);
/** Unlock all items of this type */
/**
* Try to lock all items of a type (@see sem_trywait()).
* @return 0 if lock is taken, -1 otherwise (on error or if already locked. errno is set accordingly)
*/
__EXPORT int
dm_trylock(
dm_item_t item /* The item type to lock */
);
/** Unlock all items of a type */
__EXPORT void
dm_unlock(
dm_item_t item /* The item type to clear */
dm_item_t item /* The item type to unlock */
);
/** Erase all items of this type */