Forum Discussion
Altera_Forum
Honored Contributor
21 years agoProblems with pthreds
I'm a program benchmark with pthreads, but I'm having really problems with it. Now i'm only want to do a simple hello world, but when I execute it the uClinux reinit another time. Can som...
Altera_Forum
Honored Contributor
21 years agoHi Guillemn,
Try these changes: <div class='quotetop'>QUOTE </div> --- Quote Start --- /*void print_message_function( void ){*/ void print_message_function (void *arg){ char message = "Hello"; printf("%s ", message); pthread_exit(NULL); } void main (int argc, char *argv[]){ pthread_t thread1, thread2; //char *message1 = "Hello"; //char *message2 = "World"; //pthread_attr_t pthread_attr_default; printf("\nThread 1"); pthread_create( &thread1, NULL, (void*)&print_message_function, NULL); printf("\nThread 2"); pthread_create( &thread2, NULL, (void*)&print_message_function, NULL); /*pthread_exit(NULL);*/ /* Wait for threads to exit before trashing the pthread_t vars (on stack)*/ pthread_join (thread1, NULL); pthread_join (thread2, NULL); exit(0); }[/b] --- Quote End --- Regards, --Scott