[zeromq-dev] api_thread_t in multi-threaded app

Martin Sustrik sustrik at fastmq.com
Thu Aug 6 16:10:02 CEST 2009


Robert Zhang wrote:
> Hi,
>   I have a multi-threaded application that would like to use a single 
> api_thread_t object to send messages. Is it ok to put a lock around the 
> send call? The doc mentioned one would create an api_thread_t for each 
> thread in the app, that approach is not very practical in my app.

As long as you don't invoke app_thread_t methods from 2 threads 
simultaneously, everything should work OK. However, keep in mind that 
inter-thread synchronisation (locking) is costly so you won't be able to 
get top performance that way.

Martin




More information about the zeromq-dev mailing list