From owner-freebsd-questions@FreeBSD.ORG Sun Feb 27 19:08:44 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 8E82316A4CE for ; Sun, 27 Feb 2005 19:08:44 +0000 (GMT) Received: from xenial.mcc.ac.uk (xenial.mcc.ac.uk [130.88.203.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4BF7143D39 for ; Sun, 27 Feb 2005 19:08:44 +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 1D5TmV-000CwV-GC for freebsd-questions@freebsd.org; Sun, 27 Feb 2005 19:08:43 +0000 Received: from dogma.freebsd-uk.eu.org (localhost [127.0.0.1]) j1RJ8heu035214 for ; Sun, 27 Feb 2005 19:08:43 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 j1RJ8g94035213 for freebsd-questions@freebsd.org; Sun, 27 Feb 2005 19:08:42 GMT Date: Sun, 27 Feb 2005 19:08:42 +0000 From: Jonathon McKitrick To: freebsd-questions@freebsd.org Message-ID: <20050227190842.GC34795@dogma.freebsd-uk.eu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Subject: 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: Sun, 27 Feb 2005 19:08:44 -0000 I have a few threads that might need as long as a minute or more to complete and terminate. If they exceed an arbitrary time, they can be canceled. In Win32, there is a 'wait on multiple objects' call. I'm not sure if it blocks or spins, but it *does* take a timeout argument. Is there a similar way with pthreads that I can use that will kill the threads after a certain time, but without spinlocking? After a minute of spinning, my laptop fan kicks on, and I'd like to be a bit more reasonable about my CPU cycle demands. :-) Jonathon McKitrick -- My other computer is your Windows box.