I am using libcurl
to do url request, the network latency is not acceptable. so i want it to be non blocking.
the bad news is libcurl
non-blocking method is very confusing, my ideal api function will be curl_perform(CRUL*, int)
, the int control blocking or non-blocking.
but libcurl
seems need to use select
to manage those url request.
in my understanding, select need loop to monitor the socket, which need a single thread, and this thread can't do anything else.
so, the other method is:
I create a shared queue, and open another thread, this thread is while(1) { check_queue(); }
when the queue is not empty, it handles the data.
so, my main thread just put the request into queue, then it can do other things.
what is the difference between select and another thread?