MCPcopy Create free account
hub / github.com/ElementsProject/lightning / io_loop_with_timers

Function io_loop_with_timers

lightningd/io_loop_with_timers.c:8–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <lightningd/lightningd.h>
7
8void *io_loop_with_timers(struct lightningd *ld)
9{
10 void *retval = NULL;
11 struct timer *expired;
12
13 while (!retval) {
14 /* ~ccan/io's io_loop() continuously calls
15 * io_poll_lightningd() for all file descriptors registered
16 * with it, then calls their callbacks or closes them if they
17 * fail, as appropriate.
18 *
19 * It will only exit if there's an expired timer, *or* someone
20 * calls io_break, or if there are no more file descriptors
21 * (which never happens in our code). */
22 retval = io_loop(ld->timers, &expired);
23
24 /*~ Notice that timers are called here in the event loop like
25 * anything else, so there are no weird concurrency issues. */
26 if (expired) {
27 /* This routine is legal in early startup, too. */
28 if (ld->wallet)
29 db_begin_transaction(ld->wallet->db);
30 timer_expired(expired);
31 if (ld->wallet)
32 db_commit_transaction(ld->wallet->db);
33 }
34 }
35
36 return retval;
37}

Callers 5

setup_topologyFunction · 0.85
plugins_initFunction · 0.85
plugins_configFunction · 0.85
config_pluginFunction · 0.85
mainFunction · 0.85

Calls 3

io_loopFunction · 0.85
timer_expiredFunction · 0.85
db_commit_transactionFunction · 0.50

Tested by

no test coverage detected