diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2018-05-03 13:59:12 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2018-05-03 13:59:12 -0700 |
commit | fda0975cb75f439e74231b68afdc76ee754ae7ca (patch) | |
tree | e196fd8f31c671658b86efb7eec29c219f45ecf3 /src/pulp.c | |
parent | b6723b2566f3613eb2a8a6bfd02fea89adcfd9b4 (diff) |
libpulp: move expire_alarms() to pulp_tick() begin
Expiring alarms of sleeping fibers in pulp_schedule() has the potential
to prevent pulp_tick() from ever returning if there's always another
fiber expiring @ schedule.
In order to allow simple integration with external event loops, pulp_tick()
is supposed to operate on what is essentially a slice of runnable fibers
then immediately return control to the caller.
Diffstat (limited to 'src/pulp.c')
-rw-r--r-- | src/pulp.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -269,8 +269,6 @@ static void pulp_schedule(pulp_t *pulp) assert(pulp); - expire_alarms(pulp); - current = pulp->current; pulp->current = NULL; @@ -296,6 +294,8 @@ int pulp_tick(pulp_t *pulp, unsigned *next_tick_delay_us) { assert(pulp); + expire_alarms(pulp); + swap_context(&pulp->caller_context, &pulp->schedule_context); if (pulp->exited) |