The only thing I can think of offhand is that each consumer must send a
"ready" event when it completes and 'waitFor' is then a blocking call to
receive this event from the correct consumer.

You could perhaps implement it as a future that 'waitFor' derefs, or you
could send the ready events to a channel that you can then access with
mult/tap and wait on.

You would have to be careful though: I'm not sure how you would implement
that if you waitFor a consumer that isn't running, that its a no op
(otherwise you would deadlock) - perhaps you keep a list of consumers (that
you keep up to date as consumers appear and disappear - eg in
will-mount/will-unmount) that you first check before blocking.


On 31 August 2014 15:21, stephanos <[email protected]> wrote:

> Let's take the example from the Flux Dispatcher documentation:
>
> "Consider a hypothetical flight destination form, which selects a default
> city (CityStore) when a country (CountryStore) is selected. When a user
> changes the city or the country, an according payload is dispatched. This
> payload is digested by both stores. When the callback to update
> CountryStore is registered, we save a reference to the returned token.
> Using this token with waitFor(), we can guarantee that CountryStore is
> updated before the callback that updates CityStore needs to query its data."
>
> --
>
> So by using 'waitFor' they declared an order among the payload consumers.
> I'm wondering how to do this in core.async.
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to