What am I doing wrong? Canceling a thread...
From: Steven (steeve_at_test.com)
Date: 10/31/03
- Previous message: MEA: "Re: whats the best linux for a beginner"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Oct 2003 23:22:35 -0600
Hello,
I think Im gonna shot myself. Okay, heres the situation
Im creating a thread, with this simple code
int counter=0;
pthread_t thread[5];
pthread_create(&thread[counter], NULL, work, NULL);
//that works fine
//work is a separate routine and is defined as
void* work(void* arg) { while(1); } /// yes i acctually need a infinite
while loop, no problems here
The problem is with canceling this thread. The statement below DOES print
out 'done' so the thread should be canceled, BUT when I do 'ps -A |grep
a.out' in a separate window I STILL see the old thread running! Whats
going on. How do you cancel a thread??
if (pthread_cancel(thread[0])==0)
fprintf(stderr,"done");
Thank you
- Previous message: MEA: "Re: whats the best linux for a beginner"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]