Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.straub-nv.de!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!news.internetia.pl!not-for-mail From: bartek szurgot Newsgroups: comp.programming.threads Subject: Re: String multithreading issue Date: Thu, 20 Sep 2012 17:53:05 +0200 Organization: Netia S.A. Lines: 20 Message-ID: References: <0992cd7c-02bf-47e6-8c88-a171b7de8408@googlegroups.com> NNTP-Posting-Host: 90-156-41-229.internetia.net.pl Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: mx1.internetia.pl 1348156663 6797 90.156.41.229 (20 Sep 2012 15:57:43 GMT) X-Complaints-To: abuse@inetia.pl NNTP-Posting-Date: Thu, 20 Sep 2012 15:57:43 +0000 (UTC) In-Reply-To: <0992cd7c-02bf-47e6-8c88-a171b7de8408@googlegroups.com> X-Tech-Contact: usenet@internetia.pl User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120817 Icedove/10.0.6 X-Server-Info: http://www.internetia.pl/ Xref: csiph.com comp.programming.threads:1083 On 09/20/2012 09:50 AM, itt ium wrote: > int main() > { > pthread_t tid[2]; > pthread_create(&tid[0], NULL, do_work, NULL); > pthread_create(&tid[1], NULL, do_work, NULL); > > return 0; > } you do not join your threads, so you have a race - if threads will not end before program exits, you have a problem. my guess is that when run from shell, threads are not even started, but hellgrind uses different scheduling algorithm, so you get an error. -- pozdrawiam serdecznie / best regards, bartek szurgot /* http://www.baszerr.eu */