From 149643c5638f39ba03a49b8483921ce53c643a4d Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 13 May 2018 23:35:07 -0700 Subject: libpulp: add pulp_self() current fiber accessor Analogous to pthread_self() --- src/pulp.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/pulp.c') diff --git a/src/pulp.c b/src/pulp.c index 179451e..4166dc5 100644 --- a/src/pulp.c +++ b/src/pulp.c @@ -401,6 +401,13 @@ pulp_fiber_t * pulp_fiber_new(pulp_t *pulp, unsigned delay_ms, thunk_t *thunk) } +/* return the current fiber */ +pulp_fiber_t * pulp_self(pulp_t *pulp) +{ + return pulp->current; +} + + /* sleep for the supplied number of microseconds (not public) */ static void pulp_usleep(pulp_t *pulp, unsigned useconds) { -- cgit v1.2.3