summaryrefslogtreecommitdiff
path: root/src/pulp.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2018-05-03 13:59:12 -0700
committerVito Caputo <vcaputo@pengaru.com>2018-05-03 13:59:12 -0700
commitfda0975cb75f439e74231b68afdc76ee754ae7ca (patch)
treee196fd8f31c671658b86efb7eec29c219f45ecf3 /src/pulp.c
parentb6723b2566f3613eb2a8a6bfd02fea89adcfd9b4 (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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pulp.c b/src/pulp.c
index fdb95cd..179451e 100644
--- a/src/pulp.c
+++ b/src/pulp.c
@@ -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)
© All Rights Reserved