![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Threads and Threads Count ? | varungupta | UNIX for Advanced & Expert Users | 2 | 03-21-2008 06:23 PM |
| How many threads do I use ? | the_learner | UNIX for Advanced & Expert Users | 5 | 07-17-2007 02:31 PM |
| threads | vijlak | SUN Solaris | 3 | 01-29-2007 04:55 PM |
| old threads | norsk hedensk | Post Here to Contact Site Administrators and Moderators | 2 | 06-03-2003 02:16 PM |
| nfs threads | i2admin | UNIX for Advanced & Expert Users | 1 | 03-06-2003 08:28 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
Threads = SIGSEV ?
I'm studing about thread and sometimes when I run this code i receive a SIGSEV
someone have some idea of wath is occuring? gcc thread.c -o thread -pthread Code:
#include <stdio.h>
#include <pthread.h>
int xip=0;
int main(){
int *thc;
//pthread_create(PID,thread arguments,Process begin,arguments)
pthread_create(&thc, NULL,newthread(),NULL);
printf("World\n");
exit(0);
}
int *newthread(){
printf("Hello ");
return(0);
}
sendai@slack:~$ ./thread Hello World Segmentation fault sendai@slack:~$ ./thread Hello World sendai@slack:~$ ./thread Hello World sendai@slack:~$ gdb thread >run Starting program: /home/sendai/thread [Thread debugging using libthread_db enabled] [New Thread 16384 (LWP 2412)] [New Thread 32769 (LWP 2414)] [New Thread 16386 (LWP 2415)] Hello World Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 16386 (LWP 2415)] 0x00000000 in ?? () |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
try this one
Code:
int thc; //pthread_create(PID,thread arguments,Process begin,arguments) pthread_create(&thc, NULL,newthread(),NULL); |
|
#3
|
||||
|
||||
|
ohh
really thx
|
||||
| Google The UNIX and Linux Forums |