Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #861
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.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 00:28:32 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 40 |
| Message-ID | <1074960.584.1337066912671.JavaMail.geo-discussion-forums@ynjm4> (permalink) |
| References | <9a956a1e-3d3e-4a98-b24b-beae12f40a03@n9g2000pbi.googlegroups.com> <81db5b42-ec9a-4274-a4da-faf8b54f8161@jx17g2000pbb.googlegroups.com> |
| NNTP-Posting-Host | 168.159.160.58 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | posting.google.com 1337066912 28201 127.0.0.1 (15 May 2012 07:28:32 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Tue, 15 May 2012 07:28:32 +0000 (UTC) |
| In-Reply-To | <81db5b42-ec9a-4274-a4da-faf8b54f8161@jx17g2000pbb.googlegroups.com> |
| 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 |
| X-Received-Bytes | 2406 |
| Xref | csiph.com comp.programming.threads:861 |
Show key headers only | View raw
On Tuesday, May 15, 2012 11:26:33 AM UTC+5:30, Philip Guenther wrote:
> On May 14, 8:52 pm, somenath <somenath...@gmail.com> wrote:
> > I have the following program crashing.
> >
> > #include
>
> > #include <stdio.h>
> ...
> > int main (int argc, char *argv[])
> > {
> > 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);
> > if (status != 0)
> > puts ( "Create thread");
> > }
>
> What values does 'i' have *inside* the loop? Where are the thread ids
> stored?
>
I got the problem. I am going one more in thread_id array.
So for the other question
"VAL of i = 0
============================
Why it is printing as VAL of i = 0. Shouldn't it be 1 ? "
Is it because of undefined behavior caused by the array out bound access as well ?
Thanks for the help.
Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
pthread_join crash somenath <somenathpal@gmail.com> - 2012-05-14 20:52 -0700
Re: pthread_join crash Philip Guenther <guenther@gmail.com> - 2012-05-14 22:56 -0700
Re: pthread_join crash somenathpal@gmail.com - 2012-05-15 00:28 -0700
Re: pthread_join crash Arun Chandrasekaran <visionofarun@gmail.com> - 2012-05-15 01:51 -0700
Re: pthread_join crash Richard Kettlewell <rjk@greenend.org.uk> - 2012-05-15 11:16 +0100
Re: pthread_join crash somenathpal@gmail.com - 2012-05-15 04:03 -0700
csiph-web