diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2018-09-23 19:34:01 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2018-09-23 19:34:01 -0700 |
commit | 1fb94cc5ec1c0e3ef694b3204afa1500f65dc2f0 (patch) | |
tree | bd8aef1f3693bf3cb6d569730999e2bef606b38f | |
parent | 6d8418dbd0269f2db372902c2d1da7dc1873302b (diff) |
libpulp: drop pulp_t from pulp_fiber_get_mailslot()
This function doesn't need to know the pulp instance, and it's
awkward in scenarios involving multiple pulp instances.
The mailbox api is entirely compatible with passing messages
between fibers across disparate pulp instances. In such
scenarios, it's unobvious which pulp instance you'd supply to
this function - the sender or the recipient's? Well, neither!
This way you just supply the destination/recipient's fiber, and
it returns the mailslot if the fiber accepts mail.
-rw-r--r-- | src/pulp.c | 3 | ||||
-rw-r--r-- | src/pulp.h | 2 |
2 files changed, 2 insertions, 3 deletions
@@ -620,9 +620,8 @@ pulp_usec_t pulp_now(pulp_t *pulp) * mailbox count will be advanced wether you do anything with the mailslot or * not. It's up to you to define the contract for your fibers to agree on. */ -int pulp_fiber_get_mailslot(pulp_t *pulp, pulp_fiber_t *fiber, void ***res_mailslot) +int pulp_fiber_get_mailslot(pulp_fiber_t *fiber, void ***res_mailslot) { - assert(pulp); assert(fiber); assert(res_mailslot); @@ -41,6 +41,6 @@ void pulp_msleep(pulp_t *pulp, unsigned milliseconds, pulp_mailbox_t *mailbox); void pulp_sleep(pulp_t *pulp, unsigned seconds, pulp_mailbox_t *mailbox); pulp_usec_t pulp_now(pulp_t *pulp); pulp_fiber_t * pulp_self(pulp_t *pulp); -int pulp_fiber_get_mailslot(pulp_t *pulp, pulp_fiber_t *fiber, void ***res_mailslot); +int pulp_fiber_get_mailslot(pulp_fiber_t *fiber, void ***res_mailslot); #endif |