Skip to content
Snippets Groups Projects
Commit 19e1d90a authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Kirill Yukhin
Browse files

latch: add latch_is_locked helper


To test if latch is locked.

Part-of #6036

NO_DOC=Internal helper for next patch
NO_CHANGELOG=Internal helper for next patch

Acked-by: default avatarSerge Petrenko <sergepetrenko@tarantool.org>
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 5b3f7dee
No related branches found
No related tags found
No related merge requests found
......@@ -95,6 +95,17 @@ latch_owner(struct latch *l)
return l->owner;
}
/**
* Return true if the latch is locked.
*
* @param l - latch to be tested.
*/
static inline bool
latch_is_locked(const struct latch *l)
{
return l->owner != NULL;
}
/**
* Lock a latch. If the latch is already locked by another fiber,
* waits for timeout.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment