From owner-freebsd-questions@FreeBSD.ORG Tue Mar 1 00:29:43 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D856A16A4CE for ; Tue, 1 Mar 2005 00:29:43 +0000 (GMT) Received: from xenial.mcc.ac.uk (xenial.mcc.ac.uk [130.88.203.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4405743D54 for ; Tue, 1 Mar 2005 00:29:43 +0000 (GMT) (envelope-from jcm@FreeBSD-uk.eu.org) Received: from dogma.freebsd-uk.eu.org ([130.88.200.97]) by xenial.mcc.ac.uk with esmtp (Exim 4.43 (FreeBSD)) id 1D5vGg-000Dgr-0i for freebsd-questions@freebsd.org; Tue, 01 Mar 2005 00:29:42 +0000 Received: from dogma.freebsd-uk.eu.org (localhost [127.0.0.1]) j210TeRE098806 for ; Tue, 1 Mar 2005 00:29:41 GMT (envelope-from jcm@dogma.freebsd-uk.eu.org) Received: (from jcm@localhost) by dogma.freebsd-uk.eu.org (8.13.1/8.12.6/Submit) id j210TeaK098805 for freebsd-questions@freebsd.org; Tue, 1 Mar 2005 00:29:40 GMT Date: Tue, 1 Mar 2005 00:29:39 +0000 From: Jonathon McKitrick To: freebsd-questions@freebsd.org Message-ID: <20050301002939.GA98056@dogma.freebsd-uk.eu.org> References: <20050227190842.GC34795@dogma.freebsd-uk.eu.org> <1109577414.4874.12.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1109577414.4874.12.camel@localhost.localdomain> User-Agent: Mutt/1.4i Subject: Re: Blocking on multiple threads with timeout X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2005 00:29:44 -0000 >>> I'd like to start the init threads, put the id's in an array, block until >>> they are all done, then continue. Each thread should have its own >>> timeout >>> handling internally. >It seems to me that you are complicating the issue for no >good reason. Why are you using threads at all? 1. We want to be able to easily cancel initialization before it finishes. 2. The UI still needs to be responsive. 3. By running initialization on threads, rather than serially, the total initialization time is reduced. Otherwise, we would have to init, wait, then move to the next device. With threads, we spawn a thread for each device to send the command and wait for it, then wait for all the threads to finish. This way, total initialization will be only as long as the longest init, rather than the sum of all the times. Jonathon McKitrick -- My other computer is your Windows box.