From owner-freebsd-hackers Mon Dec 27 9:16: 3 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.erlangen.netsurf.de (erlangen.netsurf.de [194.163.170.1]) by hub.freebsd.org (Postfix) with ESMTP id EDD1014DEE for ; Mon, 27 Dec 1999 09:15:57 -0800 (PST) (envelope-from d_f0rce@gmx.de) Received: from blade (user-er-u1.erlangen.netsurf.de [194.163.170.161]) by mail.erlangen.netsurf.de (8.9.3/8.9.3) with SMTP id SAA69272 for ; Mon, 27 Dec 1999 18:15:53 +0100 (CET) Message-ID: <005101bf508e$1ab48700$0201a8c0@blade> From: "Steffen Merkel" To: Subject: Kernel threads Date: Mon, 27 Dec 1999 18:16:20 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 #include #include 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