summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-06-03libpulp: remove now unused enter_context()Vito Caputo
2018-06-03example: incorporate example pulp_exit() usageVito Caputo
This needs to be tested, though its use in the example is contrived.
2018-06-03libpulp: add pulp_exit() public prototypeVito Caputo
2018-06-03libpulp: some assert cleanupsVito Caputo
2018-06-03libpulp: always swap contextsVito Caputo
In cases where the run queue was empty, the trampoline context would immediately enter the caller context. Then the trampoline would be reused again without being re-setup. This seemed to work fine on Linux but was causing bus errors on OSX. So instead now enter_context never used and contexts are always swapped to preserve the state of the context being left, which seems to have fixed the problem on OSX.
2018-05-16libpulp: experimental considerations for OSXVito Caputo
I don't have an OSX system to test with, but after some digging this looks like it might suffice.
2018-05-16libpulp: waking note in pulp_fiber_get_mailslot()Vito Caputo
2018-05-16libpulp: add win32 supportVito Caputo
This adds a rudimentary win32 implementation based on the fibers system API. It seems to work reasonably under wine when built w/mingw32.
2018-05-14example: pass NULL mailbox to pulp_msleep()Vito Caputo
Forgot to update the example when adding the mailbox feature. Thanks Phil!
2018-05-13libpulp: introduce mailbox conceptVito Caputo
The sleep functions, which are few, and the only current means for fibers to block/enter the scheduler, now take an optional pulp_mailbox_t * parameter. When supplied, other fibers may communicate with the sleeping fiber via pulp_fiber_get_mailslot(). This function checks the destination fiber for a mailbox and verifies there's space available. On success, it returns a pointer to the next available mailslot while advancing the mailboxes mail count. The caller may then use this mailslot pointer to write directly to the void * it references in the mailbox. If the receiving fiber took care to populate its mailbox with slots referencing external memory, the sender could dereference the mailslot's value to find the external memory and write larger messages without needing to allocate new space itself only for the reciever to have to free it shortly. It's also possible to not do anything at all with the mailslot. Simply successfully getting a mailslot communicates _something_ to the recipient by virtue of the count advancing. The returned mailslot can only be considered valid by the calling fiber until it sleeps, after that the slot must be treated as reclaimed from the perspective of the fiber that called pulp_fiber_get_mailslot(). When the sleeping fiber wakes and returns from its mailbox-enabled sleep call, it simply looks at the count member of the mailbox to see if any mail was received. It's up to the implementation what is done with the contents of the mailbox. The mailbox count is always reset to 0 automatically at the start of a mailbox-enabled sleep.
2018-05-13libpulp: add pulp_self() current fiber accessorVito Caputo
Analogous to pthread_self()
2018-05-03libpulp: move expire_alarms() to pulp_tick() beginVito Caputo
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.
2018-05-03libpulp: forward declare thunk_t, omit thunk.hVito Caputo
Let the user of pulp.h control how they get at this struct, our libthunk submodule fulfills our implementation needs but the caller's build architecture should be free to fulfill this type however it wants - there may be no thunk.h at all but they still would include pulp.h.
2018-05-02build: add rudimentary automake build systemVito Caputo
2018-05-02*: initial commit of libpulpVito Caputo
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.
© All Rights Reserved