Calling ev_async_send() from multiple threads.

Marek Denis marek at octogan.net
Mon Jun 25 00:52:35 CEST 2012


Hi,

As far as I understood calling ev_async_send() on one watcher, but from 
different threads is a safe technique. However I am not really sure, 
whrther those calls will trigger callback functions the exact number of 
times the ev_async_send()  was called? I am talking about the situation 
when multiple threads call ev_async_send() at the same time.

In the libev documentation there is a examplous callback function that 
does something like this:

#v+
pthread_lock(&mutex);
 while(queue_not_empty)
  process(data_from_queue);
pthread_unlock(&mutex)
#v-

however I would like to be able to make a callback like:

#v+
pthread_lock(&mutex);
 data = get_data_from_shared_queue();
pthread_unlock(&mutex);

process(data);
#v-


Thanks for your answers.


-- 

Marek Denis 
[marek at octogan.net]



More information about the libev mailing list