I guess the problem is that sub-thread end with the main thread ends,
maybe you can add one line in the main function:
int main(int argc, char** argv) {
printf("We've reached here!\n");
pthread_create(&thread_id,NULL,threadtest,NULL);
while(1);
}
On 11月20日, 上午7时29分, "Ivar" <ravi.sath...@gmail.comwrote:
Quote:
Hi,
So basically in my application I have a a main function that does
this...
>
//Global variables
pthread_t thread_id;
>
void* threadtest(void * arg) {
while(1) {
printf("Reached this segment\n");
}
return NULL;
>
}int main(int argc, char** argv) {
...
printf("We've reached here!\n");
//Line 500
>
pthread_create(&thread_id,NULL,threadtest,NULL); //Line 501
...
>
}So basically, when I run this code, I dont have my "Reached this
segment" line print out to console (so basically I feel the thread is
not being entered). But when I run in gdb, put a break point at line
500 in main (as shown below) and continue stepping, I reach the thread
code and get no errors....What could be the reason that I see no thread
output?? Is it even getting there? Sorry for my english...I can explain
anything more in detail if necessary...
-Ravi