This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: I'v got nuts, please help me with the g++ option
- From: Saravanan T S <saravanan at k dot st>
- To: Jianhua xu <joshua_60030 at yahoo dot com>, gcc-help at gcc dot gnu dot org
- Date: Sun, 7 Sep 2003 21:13:43 -0700 (PDT)
- Subject: Re: I'v got nuts, please help me with the g++ option
- Reply-to: saravanan at k dot st
Try replacing the
>pthread_t * thread;
with
pthread_t thread;
and creating thread with:
pthread_create (&thread,NULL,threadproc,NULL);
pthread_join (&thread, NULL);
You need to look into memory allocation for the variable thread!!
Suggestion to read Richard Stevens' book on IPC.
Sar
--- Jianhua xu <joshua_60030@yahoo.com> wrote:
>Dear Mr./Madam,
> I installed a Redhat9(shrike), g++ 3.2.2 , libgcc
>3.2.2, got Segmentation fault when using
>pthread_create function. the try program is very
>simply, please tell me which header file and library i
>should use when linking.
>
>following is my program
>
>#include <>
>#include <pthread.h>
>void * threadproc(void*p)
>{
>printf("dd\n");
>}
>int main(int argc,char** argv)
>{
>pthread_t * thread;
>pthread_create(thread,NULL,threadproc,NULL);
>pthread_join(*thread,NULL);
>return 1;
>}
>
>
>Thanks & Regards,
>
>joshua
>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
_____________________________________________________________
Powered by a short email address ... http://www.k.st