[
https://issues.apache.org/jira/browse/PROTON-1440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15928876#comment-15928876
]
Alan Conway commented on PROTON-1440:
-------------------------------------
Review request: https://github.com/alanconway/qpid-proton/tree/safe-wake
https://reviews.apache.org/r/57702/
I have not changed the API - no return from wake. We can't (easily) guaratnee
that the return value is correct, since the user has control of the event
stream between _wait() and _done(), so calls to wake() concurrent with that are
somewhat out of our control. So better to say nothing than claim there will be
a WAKE event when there may not be. Wake is fully thread safe however, it can
be called even after the proactor has been freed, but is a no-op.
The real issue is co-ordination with state outside the proactor, which can't be
done from inside. Bindings like C++ can still provide more user-friendly
guarantees, e.g. the c++ inject() or dispatch qd_deferred_call guarantees can
still be implemented but need sync outside the proactor (for C++ it's in the
event_loop).
> pn_connection_wake to return bool status
> ----------------------------------------
>
> Key: PROTON-1440
> URL: https://issues.apache.org/jira/browse/PROTON-1440
> Project: Qpid Proton
> Issue Type: Improvement
> Components: proton-c
> Affects Versions: 0.17.0
> Reporter: Alan Conway
> Assignee: Alan Conway
> Fix For: 0.18.0
>
>
> pn_connection_wake() allows any thread to send a PN_CONNECTION_WAKE event to
> a proactor-managed connection. Currently it does not return any value, and
> the application must ensure it is not called after the PN_TRANSPORT_CLOSED
> event is processed for that connection.
> This is tricky for the application to synchronize and inconsistent with other
> pn_connection_ functions. If refcounts are used to keep a pn_connection_t in
> memory after the TRANSPORT_CLOSED, then calling wake() is an error even
> though the pn_connection_t is valid.
> Change wake to be safe as long as the pn_connection_t is valid. It returns
> true if the connection will be woken, false if it is too late.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]