You would need a mutex protecting the messenger object in order to safely call pn_messenger_accept from another thread. You can do it, but it would likely run into complications since the messenger thread would need to hold the mutex while blocking.
I'm guessing if you are processing messages in a different thread then you must have some thread-safe strategy for passing message data from the messenger thread over to the processing thread, i.e. a thread safe queue of messages to be processed. I would think the simplest thing to do would be to simply set up another such queue in the reverse direction to pass trackers from the processing thread back to the messenger thread and call pn_messenger_accept from there. --Rafael On Fri, Jan 17, 2014 at 10:00 AM, serega <[email protected]> wrote: > There are several discussions on this forum regarding multi-threading, and > as > I understand messenger isn't thread safe. However, my use case is simple. > A single thread receives messages, but message processing is handed over to > another thread > > Is it possible to call pn_messenger_accept(messenger, tracker, 0) from > another thread? > > - Sergey > > > > -- > View this message in context: > http://qpid.2158936.n2.nabble.com/call-pn-messenger-accept-from-another-thread-tp7602918.html > Sent from the Apache Qpid Proton mailing list archive at Nabble.com. >
