[rabbitmq-discuss] rabbitmq-c thread-safe

Theo Schlossnagle jesus at omniti.com
Sat Nov 14 18:45:38 GMT 2009


The current tip of rabbit-mq has two issues:

The first is that it declares many blank structures:
 typedef struct foo { } foo_t;

Many compilers don't allow this -- in fact, gcc is the only know I know of that does.  This should be changed to something like:
 typedef struct foo { unsigned unused:1; } foo_t;

This is autogenerated code...


The second issue is that the library uses a global variable to track the reply state on the a connection making it not thread safe.  I've patched the tip, it is attached.

I'd love to just declare the variable as __thread, but too many compilers and platforms do not support that annotation.  So, I've used a pthread_key to localize the reply variable per thread. "works for me"


I'm not "on list", so please keep me in the Cc if you've any questions, thoughts or concerns.

Thanks!

Also, rabbitmq-c has been exposed for perl-lovers as Net::RabbitMQ on CPAN.

--
Theo Schlossnagle
http://omniti.com/is/theo-schlossnagle


-------------- next part --------------
A non-text attachment was scrubbed...
Name: thread-safe.diff
Type: application/octet-stream
Size: 5250 bytes
Desc: not available
Url : http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20091114/ba9a66ba/attachment.obj 
-------------- next part --------------





More information about the rabbitmq-discuss mailing list