From owner-freebsd-hackers Wed Dec 29 12: 9: 2 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 E122214DA2 for ; Wed, 29 Dec 1999 12:08:58 -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 VAA41499 for ; Wed, 29 Dec 1999 21:08:51 +0100 (CET) Message-ID: <000701bf5238$9918aa80$0201a8c0@blade> From: "Steffen Merkel" To: Subject: Sorry, but another thread problem! Date: Wed, 29 Dec 1999 21:09: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, first let me thank all of you for all your great help and the dozens of responses I got. Unfortunately I have a very strange problem in a multithreaded programm I'm writing now. I want to write a programm which checks if a server is up by pinging it. I looks like that: ###################################### main(){ readconfig() for (every server){ pthread_create(..... startscan() ); } while(1){ sleep(1); printf("Main Awake again\n"); } } startscan(){ ping(server); printf("Going to sleep\n"); sleep(1); printf("Awake again!"); } ######################################## I can see that the servers are getting pinged and that every thread goes to sleep. As soon as every thread did it's job and the first thread should awake the program get's a SIGSEGV. I can't see the message "Awake again" from the first thread but I saw that the first thread started to sleep and the last thread finished too and the main thread printed "Awake again!". Well with my little knowledge of C I would say that there is a problem with the sleep function. But as soon as I remove the ping() function the programm operates normally and runs forever. Can anyone tell me how I can debug such a problem? A program which seems to crash because of function which doesn't get executed at crash time. Meanwhile I'm going mad with those threads because the program worked fine using fork(). Unfortunately it takes too much ram to fork a process for every server. That's the reason I want to use threads. Steffen PS: Sorry that I have to bother you again with my incompetence. Please reply directly to me because I'm not on the list. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message