core-lightning/common/io_debug.c
Rusty Russell 3404c393b7 common/io_debug: replacement for ccan/io's poll which does sanity checks.
For now we just check for outstanding take() or tal_tmpctx().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-09-29 10:20:08 +09:30

20 lines
369 B
C

#include <ccan/err/err.h>
#include <ccan/take/take.h>
#include <common/io_debug.h>
#include <common/utils.h>
int debug_poll(struct pollfd *fds, nfds_t nfds, int timeout)
{
const char *t;
t = taken_any();
if (t)
errx(1, "Outstanding taken pointers: %s", t);
t = tmpctx_any();
if (t)
errx(1, "Outstanding tmpctx: %s", t);
return poll(fds, nfds, timeout);
}