Hi.
I have a routine which suspends a MHD connection and calls the following functions when it starts:
1.
2.
3.
1.
MHD_resume_connection()2.
some callback()3.
pthread_exit()but the server may be stopped by the user and return from
main() before the stages 2 and 3 above get finished, however, the
pthread_create(3) says: "
The new thread terminates in one of the following ways: - Any of the threads in the process calls exit(3), or the main thread performs a return from main(). This causes the termination of all threads in the process".
I thought it would be necessary to add some lockable list (with mutex) in the server to iterate all the threads and cancel them before finishing the server, but it seems I don't need it, since all the threads are already exited with main thread, and my application don't need to stop gracefully.
So, can I follow using such design and run it in production?
TIA for any suggestions!