Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: pthread memory leaks Date: Wed, 01 Jun 2011 21:05:31 +1200 Lines: 32 Message-ID: <94mdmsF12lU6@mid.individual.net> References: <9430fe32-d385-49a3-b925-daf3cd421789@j13g2000pro.googlegroups.com> <211062bc-81c2-40d2-b6f2-ebd587ff179c@n10g2000vby.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net dtzBAzDdLSG2XCjmSNzGWAzn5SGCTcSbuSlvD+FPFNMbXfr8rA Cancel-Lock: sha1:VHjqMFKKzC3O9goHpb8hGpx5hxU= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:5950 On 06/ 1/11 08:27 PM, Jorgen Grahn wrote: > On Tue, 2011-05-31, Adam Skutt wrote: >> On May 30, 7:29 pm, jakash3 wrote: >>> I'm experimenting with signals and conditional variables to implement >>> thread suspension. >> >> Don't. It will only work on Linux, and even then, you'll run into >> many subtle and difficult to debug issues. Threads and signals simply >> do not mix, period. Even if you get your internal signal delivery >> working, you still have to make sure you properly cope with externally >> delivered signals as well, which can be tricky or outright >> impossible. > > A short offtopic question to that: with signals being such an integral > part of Linux, aren't you really saying Linux and threads don't mix? > Or are you taking differences beween Linux and other Unixes into > account here? Maybe you are think of the older Linux Threads (where a thread was process), used before Linux adopted POSIX threads? > I'm asking because I recently read an article where the author > asserted that mixing signals and pthreads [specifically on Linux] is > much simpler than people think. (No, I don't have the URL handy, and > no, I don't trust that author absolutely.) It generally is, just so long as you don't try and use any pthread call in a signal handler! One of the most convenient uses is to dedicate a thread to handling the process' signals. -- Ian Collins