>evhttp cannot be used from multiple threads. If you want to post messages from other threads, you should use message queues between the libevent http thread and the other threads. > >To pass a message to evhttp thread, add the message to the queue, and use event_activate() to wake up the event loop. In the event callback, pop messages from the queue and handle them (e.g. send http post >request). > Works like a champ! Thanks for the help. I especially liked the ease in adding a sanity timer via the event_activate() call, so occasionally the code can wake up and make sure the transmit queue is empty. It is defensive code, I know, but sometimes a few lines like this can avoid problems that can take a long time to find. > You don't need the while loop around event_base_dispatch - it is your loop. I've used Boost for a few things, and in that library, I found the service thread does return occasionally. It was defensive code, sort of my seat belt.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature