[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Double regarding suspended connection and pthread_ex
Re: [libmicrohttpd] Double regarding suspended connection and pthread_exit
Mon, 16 Mar 2020 23:37:22 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0
On 3/16/20 9:16 PM, silvioprog wrote:
> On Mon, Mar 16, 2020 at 4:29 PM Christian Grothoff <address@hidden
> <mailto:address@hidden>> wrote:
> This seems kind-of OK (I personally think pthread_detach is always messy
> and in 99.9% of cases a bad idea).
> Hm... Could you point the disadvantages of using detached threads? I'm a
> little newbie with this feature of pthreads.
Usually, you will eventually find that you do need to wait on the thread
to finish for a controlled shutdown, and at that point it is then better
to keep the thread handles in some data structure so you can join. At
least I found that to be virtually always the case when doing
disciplined multi-threaded programming. But, this is certainly not
fundamental, and you might be able to write perfectly correct programs
with detached threads.
Your existing approach, for example, does not seem to naturally support
a clean shutdown of the process using CTRL-C / SIGTERM.
Description: OpenPGP digital signature