[rabbitmq-discuss] Pika and multi-threading
Denis Conan
Denis.Conan at telecom-sudparis.eu
Wed Feb 23 14:29:24 GMT 2011
Le 22/02/2011 17:02, Gavin M. Roy a écrit :
> 2011/2/22 Denis Conan<Denis.Conan at telecom-sudparis.eu>:
>>
>> Hi all,
>>
>> The Pika Web site says: "Pika does not have any notion of threading in the
>> code. If you want to use Pika with threading, make sure you have a Pika
>> connection per thread, created in that thread. It is not safe to share one
>> Pika connection across threads."
>>
>> When using the continuation-passing style mode with SelectConnection, what
>> about the singleton object IOLoop? I created a connection on the main thread
>> for a vhost, and then a second connection for a different vhost in a new
>> thread, but callbacks of the main threads for the first vhost are called. Am
>> I missing something?
>
> You're not, this is something I'm working through now. In essence,
> there is a logical separation in the pika code between the core of how
> pika does what it does and the connection adapters. The singleton
> model for ioloops was a later addition that broke the model with
> regard to threads. I have been working on fixing this to be thread
> safe and will have something out soon on it.
>
Thank your for the answer.
In the meantime, forking the process may be an alternative. Is there a "simple"
mean to de-register a callback?
CU
Denis
More information about the rabbitmq-discuss
mailing list