mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-10 09:34:22 +01:00
common/io_lock: add helper to query if lock is taken.
Not just for debugging; we actually need to know if a write is active for the coming hack. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -80,3 +80,8 @@ void io_lock_release(struct io_lock *lock)
|
||||
lock->locked = false;
|
||||
io_wake(lock);
|
||||
}
|
||||
|
||||
bool io_lock_taken(const struct io_lock *lock)
|
||||
{
|
||||
return lock->locked;
|
||||
}
|
||||
|
||||
@@ -47,4 +47,9 @@ struct io_plan *io_lock_acquire_in_(struct io_conn *conn, struct io_lock *lock,
|
||||
*/
|
||||
void io_lock_release(struct io_lock *lock);
|
||||
|
||||
/**
|
||||
* Is this lock acquired?
|
||||
*/
|
||||
bool io_lock_taken(const struct io_lock *lock);
|
||||
|
||||
#endif /* LIGHTNING_COMMON_IO_LOCK_H */
|
||||
|
||||
Reference in New Issue
Block a user