Hello,
thanks for all your help on my previous posting. Meanwhile my
thread-test works as I followed your instructions and included
a sleep() call.
But on experimenting on this topic I exchanged the sleep() call
with a "while(1);" and had to see that the programm doesn't work
any more.
Why?
I thougt POSIX threads would be kernel threads and therefor
every thread gets a bit cpu time.
Any ideas?
Please answer to me directly as I'm not on the list.
Stefen
This programm was compiled with:
gcc -pthread -o pthread pthread.c
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void print( void *ptr ){
char *string;
string = (char *) ptr;
fprintf(stderr,"String: %s\n",string);
}
void main(void){
pthread_t thread;
char *string = "Hallo";
if( pthread_create( &thread, pthread_attr_default, (void *)&print, (void
*) string ) != 0 ){
perror("pthread_create()");
exit(EXIT_FAILURE);
}
/* adding this, the programm doesn't work any more */
/* while(1); */
sleep(1);
}
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message