summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2018-09-23 19:34:01 -0700
committerVito Caputo <vcaputo@pengaru.com>2018-09-23 19:34:01 -0700
commit1fb94cc5ec1c0e3ef694b3204afa1500f65dc2f0 (patch)
treebd8aef1f3693bf3cb6d569730999e2bef606b38f
parent6d8418dbd0269f2db372902c2d1da7dc1873302b (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.c3
-rw-r--r--src/pulp.h2
2 files changed, 2 insertions, 3 deletions
diff --git a/src/pulp.c b/src/pulp.c
index 7f69a4a..e472fb9 100644
--- a/src/pulp.c
+++ b/src/pulp.c
@@ -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);
diff --git a/src/pulp.h b/src/pulp.h
index 39a5b67..9d5f559 100644
--- a/src/pulp.h
+++ b/src/pulp.h
@@ -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
© All Rights Reserved