Browse Source

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>
ppa-0.6.2rc1
Rusty Russell 6 years ago
parent
commit
240abf6c46
  1. 5
      common/io_lock.c
  2. 5
      common/io_lock.h

5
common/io_lock.c

@ -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;
}

5
common/io_lock.h

@ -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 */

Loading…
Cancel
Save