mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 22:03:34 +08:00
dataman: add dm_trylock & add lock for FENCE_POINTS items
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user