diff options
Diffstat (limited to 'src/pulp.c')
-rw-r--r-- | src/pulp.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -279,7 +279,7 @@ static void destroy_context(pulp_context_t *context) /* Infinitely schedules fibers, this gets its own context in * pulp->trampoline_context. * - * On ucontext systems, this is what uc_link executes. + * On ucontext systems, this is what pulp_tick() and uc_link swap to. * * On win32, there's a win32_trampoline helper which wraps the fiber's * function, entering pulp->trampoline_context when the fiber's function @@ -427,6 +427,7 @@ static void pulp_schedule(pulp_t *pulp) int pulp_tick(pulp_t *pulp, unsigned *next_tick_delay_us) { assert(pulp); + assert(!pulp->current); expire_alarms(pulp); @@ -571,6 +572,7 @@ pulp_fiber_t * pulp_self(pulp_t *pulp) static void pulp_usleep(pulp_t *pulp, unsigned useconds, pulp_mailbox_t *mailbox) { assert(pulp); + assert(pulp->current); pulp->current->state.sleep.mailbox = mailbox; if (mailbox) @@ -586,8 +588,6 @@ static void pulp_usleep(pulp_t *pulp, unsigned useconds, pulp_mailbox_t *mailbox /* if mailbox is non-NULL it may be used to receive mail while sleeping via pulp_fiber_get_mailslot() */ void pulp_msleep(pulp_t *pulp, unsigned milliseconds, pulp_mailbox_t *mailbox) { - assert(pulp); - return pulp_usleep(pulp, milliseconds * PULP_USECS_PER_MSEC, mailbox); } @@ -596,8 +596,6 @@ void pulp_msleep(pulp_t *pulp, unsigned milliseconds, pulp_mailbox_t *mailbox) /* if mailbox is non-NULL it may be used to receive mail while sleeping via pulp_fiber_get_mailslot() */ void pulp_sleep(pulp_t *pulp, unsigned seconds, pulp_mailbox_t *mailbox) { - assert(pulp); - return pulp_usleep(pulp, seconds * PULP_USECS_PER_SEC, mailbox); } @@ -608,6 +606,8 @@ void pulp_sleep(pulp_t *pulp, unsigned seconds, pulp_mailbox_t *mailbox) */ pulp_usec_t pulp_now(pulp_t *pulp) { + assert(pulp); + return pulp->now; } |