From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 5F33CBBAF for ; Sat, 17 Jul 2010 16:08:16 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhMDAONVQUzZSMDjkWdsb2JhbACfbhUBAQEBCQsKBxEDH78thSUE X-IronPort-AV: E=Sophos;i="4.55,219,1278280800"; d="scan'208";a="66589391" Received: from fmmailgate02.web.de ([217.72.192.227]) by mail4-smtp-sop.national.inria.fr with ESMTP; 17 Jul 2010 16:08:16 +0200 Received: from smtp02.web.de ( [172.20.0.184]) by fmmailgate02.web.de (Postfix) with ESMTP id 655D516C42A49; Sat, 17 Jul 2010 16:08:15 +0200 (CEST) Received: from [78.43.204.177] (helo=frosties.localdomain) by smtp02.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #4) id 1Oa83r-0001tG-00; Sat, 17 Jul 2010 16:08:15 +0200 Received: from mrvn by frosties.localdomain with local (Exim 4.72) (envelope-from ) id 1Oa83q-0007ib-HB; Sat, 17 Jul 2010 16:08:14 +0200 From: Goswin von Brederlow To: Romain Beauxis Cc: Goswin von Brederlow , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Smart ways to implement worker threads References: <87sk3mcaeq.fsf@frosties.localdomain> <201007160820.37108.toots@rastageeks.org> <87lj9a79y3.fsf@frosties.localdomain> <201007170951.07709.toots@rastageeks.org> Date: Sat, 17 Jul 2010 16:08:14 +0200 In-Reply-To: <201007170951.07709.toots@rastageeks.org> (Romain Beauxis's message of "Sat, 17 Jul 2010 09:51:07 -0400") Message-ID: <878w5aryk1.fsf@frosties.localdomain> User-Agent: Gnus/5.110009 (No Gnus v0.9) XEmacs/21.4.22 (linux, no MULE) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: goswin-v-b@web.de X-Sender: goswin-v-b@web.de X-Provags-ID: V01U2FsdGVkX1+cFJRDG+ibrMA/4Otw6F5SfWXxXOEeLU8e4TEA YMUYp69Hrp37WvFX/FQebT3duXvKuLsLMIY9HmU1ml2jMmitLi WSklaazJc= X-Spam: no; 0.00; 48,:98 mfg:98 threads:01 threads:01 caml-list:01 writes:01 implement:06 ecrit:06 thread:06 thread:06 meant:06 queue:07 queue:07 mean:08 i'm:09 Romain Beauxis writes: > Le samedi 17 juillet 2010 05:07:48, Goswin von Brederlow a écrit : >> No, it couldn't. The main thread must be blocked waiting for something. >> That something would either be waiting for select to return or the main >> thread runs a queue and a seperate select thread and worker threads >> throw tasks at it. I'm not having a main thread that checks every 0.001s >> if a task happens to be done. > > Then use a Condition.wait on the main thread and Condition.signal in each > tasks. This is meant for that. > > I mean, there's not gonna be a ready-to-use solution for you. At some point > you'll have to be a little bit creative. > > > Romain Sure. I was just explaining why I made the main thread run a queue and wait for tasks as well, not just the worker threads. MfG Goswin