Age | Commit message (Collapse) | Author |
|
Rather than having pulp_tick() on win32 always fiberize/unfiberize the
thread at the start/end of the tick, just fiberize once at library
initialization time.
The old approach was problematic with nested pulp instances. As in,
when a fiber called pulp_tick() on another pulp_t, in scenarios where
the programmer has arranged for a fiber heirarchy of sorts, the nested
pulp_tick() would once again fiberize the already fiberized thread,
then unfiberize, and poof the magic smoke comes out.
Rather than maintaining some kind of reference count and transparently
fiberize vs. getcurrentfiber in pulp_tick(), I'm just introducing the
explicit initialization to address this limitation. This way
pulp_tick() can just always get the current fiber for the calling
context on win32.
The initializer currently does nothing on *nix/ucontext.h systems,
this is just a win32 issue.
|
|
This needs to be tested, though its use in the example is contrived.
|
|
Forgot to update the example when adding the mailbox feature.
Thanks Phil!
|
|
libpulp is a very basic cooperatively-scheduled userspace threading
library. It refers to the userspace threads as fibers, and uses my
other little library libthunk to bind the functions and their calling
environment into tidy little structures having a uniform calling
convention.
At this time there's no build system or anything of the sort, it's
early days and I'll probably be submoduling this into another project
for direct inclusion and compilation.
|