> this should be composite_error(), as the trigger versions are only used
> in the _send() function that creates the composite_context, and where a
> async callback
> isn't set by the caller.
I've been trying to think of a way to automate this, as its a trap
that I think lots of people will fall info. It would be nice if
composite_error() and other helper functions just "did the right
thing" in both situations, without the caller having to care about
whether its the initial send or not.
A simple approach would be to add an internal flag (perhaps
'called_wait') to the composite_context structure, which is set when
composite_wait() is called. Then composite_error() would call
composite_trigger_error() if there is no ctx->async.fn callback set,
and composite_wait() has not been called. Does that cover all the
The idea is that if a callback has been set, then we don't need the
timer based trigger. We also don't need the timer based trigger if the
caller is using the composite_wait() method to wait for completion (as
is used by the sync calls). In all other situations we do need the
trigger as the caller needs an opportunity to setup the callback.
Volker, do you think this sounds reasonable?