Hello,

I'm learning C now for some weeks and today I wanted to program
POSIX threads. Unfortunately my source seems not to run. Could you
please have a look at my code and tell me whats wrong:

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

void print( char *string ){
  fprintf(stderr,"String: %s\n",string);
}

void main(void){
  pthread_t thread;
  char string[] = "Hallo";

  if( pthread_create( &thread, (const pthread_attr_t *)NULL, (void *)&print,
&string ) != 0 ){
    perror("pthread_create()");
    exit(EXIT_FAILURE);
  }

}


I compiled this source with:
gcc -pthreads -o pthread pthread.c

Please reply to me directly, as I'm not subscribed to freebsd-hackers.

Thanks in advance,

Steffen





To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to