I'm trying to get a simple HTTP server done with libevent and managed to do it based on the documentation examples. However, without threads, the whole purpose of libevent is garbage. I'm not very experienced with threads in C++11, but i would love to know how to properly implement such server.
I found this example online: https://gist.github.com/kzk/665437
Is this correct? Is pthreads the proper choice? Also, this line is very strange:
for (int i = 0; i < nthreads; i++) {
pthread_join(ths[i], NULL);
}
What's going on there?