This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

pthread?


Hi, may be this question is offtopic, sorry if this is the case, any way I'll 
appresiate if someone tell me where to find a good mailing list about Linux 
programming.

Any way, my problem is with the following test code:

typedef void*(*ftype)(void*);

void *thread_test( void *arg ){
     std::cout << "New Thread: " << *((int*)arg) << std::endl;
     delete arg;
}

int main(int argc, char *argv[]){
     
     ftype function = thread_test;
     for ( int i = 0; i < 10; i++ ){
          pthread_t thread_handler;
          int * _ni = new int;
          *_ni = i;
          int res = pthread_create( &thread_handler, NULL, function, _ni );
          std::cout << "Main Thread" << std::endl;
     }


     return EXIT_SUCCESS;
}

It compiles well, but when I run it, I get a signal 11, at debbug time I 
notice the signal is generated when the pthread_create is called. Any hint?, 
any linux-prog mailing list?

best reg@rds
-- 
Israel Fdez Cabrera.
Usuario Linux: 270292	(http://counter.li.org)
israel@seg.inf.cu
Segurmatica.
La Habana, Cuba.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]