Re: error running p_threads
- From: "coconut1986@xxxxxxxxx" <coconut1986@xxxxxxxxx>
- Date: 19 Nov 2006 16:58:35 -0800
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...@xxxxxxxxx> wrote:
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
.
- Follow-Ups:
- Re: error running p_threads
- From: Ivar
- Re: [OT] error running p_threads
- From: Ian Collins
- Re: error running p_threads
- References:
- error running p_threads
- From: Ivar
- error running p_threads
- Prev by Date: Re: error running p_threads
- Next by Date: Re: C runtime library for Unix
- Previous by thread: Re: error running p_threads
- Next by thread: Re: [OT] error running p_threads
- Index(es):
Relevant Pages
|
|