[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] HTTP and thread safety



Hi everyone, simple question..

2 threads, T1 is in the event loop, T2 does some other things.
Assume that I have a safe way of communicating between T1 and T2.

I'm planning to use T2 to create http requests objects and then give them to T1 to actually perform the request, i.e.:

T2 calls
- evhttp_connection_base_new
- evhttp_connection_set_timeout
- evhttp_connection_set_retries
- evhttp_connection_set_closecb
- evhttp_request_new

Then T2 passes the evhttp_connection and evhttp_request to T1, who calls evhttp_make_request.
(again, assume this message passing is implemeted safely)

Is this thread safe?
Or does any of the functions invoked by T2 modify the event base (owned by T1)?

Marco