Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: somenathpal@gmail.com Newsgroups: comp.programming.threads Subject: Re: pthread_join crash Date: Tue, 15 May 2012 04:03:54 -0700 (PDT) Organization: http://groups.google.com Lines: 19 Message-ID: <8599463.3435.1337079834269.JavaMail.geo-discussion-forums@ynja13> References: <9a956a1e-3d3e-4a98-b24b-beae12f40a03@n9g2000pbi.googlegroups.com> <87k40d7nrk.fsf@araminta.anjou.terraraq.org.uk> NNTP-Posting-Host: 168.159.160.58 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1337079834 1128 127.0.0.1 (15 May 2012 11:03:54 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 15 May 2012 11:03:54 +0000 (UTC) In-Reply-To: <87k40d7nrk.fsf@araminta.anjou.terraraq.org.uk> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=168.159.160.58; posting-account=_MUnWAoAAABFtpVwBW4d7Ctyh2Ok_eYT User-Agent: G2/1.0 Xref: csiph.com comp.programming.threads:864 On Tuesday, May 15, 2012 3:46:15 PM UTC+5:30, Richard Kettlewell wrote: > somenath writes: > > pthread_t thread_id[2]; > > void *thread_result; > > int status; > > int i =0; > > while ( i ++ <2) { > > status = pthread_create (&thread_id[i], NULL, thread_routine, > > NULL); > > You are writing past the end of thread_id[]. > > > printf("\n VAL of i = %d\n"); > > You aren't supplying i to printf. The compiler can spot this for you, > but you need to turn warnings on. > Many thanks for the help.