[rabbitmq-discuss] Pika and multi-threading

Gavin M. Roy gmr at myyearbook.com
Tue Feb 22 16:02:21 GMT 2011

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.

More information about the rabbitmq-discuss mailing list