Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Dec 1999 14:23:40 +0100
From:      "Steffen Merkel" <d_f0rce@gmx.de>
To:        <freebsd-hackers@freebsd.org>
Subject:   Posix Threads
Message-ID:  <000c01bf4fa5$44bf5050$0201a8c0@blade>

next in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000c01bf4fa5$44bf5050$0201a8c0>