Date: Mon, 27 Dec 1999 18:16:20 +0100 From: "Steffen Merkel" <d_f0rce@gmx.de> To: <freebsd-hackers@freebsd.org> Subject: Kernel threads Message-ID: <005101bf508e$1ab48700$0201a8c0@blade>
next in thread | raw e-mail | index | archive | help
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 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?005101bf508e$1ab48700$0201a8c0>