I would like to write a daemon process which use multi-threading techniques.
Asuume the program name is thread_test.
Actually, I use accept(...) to wait for the client request. When the accept(...) function receive the client request, accept(...) will return back and call the next line, pthread_create(...) to create a new thread to do something for the client.
However, as the new thread is still running, I go to another console to type command 'ps', I am surprised that there are three copies of thread_test process which is running. Actually, I expect there are only two copies of thread_test process is running, one is main thread and the other is so-called child thread. However, right now, why there is third thread exist?
Can anyone help me to indicate what the problem is?
Thanks a lot