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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id EE4ABBBAF for ; Sat, 17 Jul 2010 11:07:49 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjADABoPQUzZSMDqkWdsb2JhbACfbhUBAQEBCQsKBxEDH78shSUE X-IronPort-AV: E=Sophos;i="4.55,218,1278280800"; d="scan'208";a="63946651" Received: from fmmailgate03.web.de ([217.72.192.234]) by mail1-smtp-roc.national.inria.fr with ESMTP; 17 Jul 2010 11:07:49 +0200 Received: from smtp07.web.de ( [172.20.5.215]) by fmmailgate03.web.de (Postfix) with ESMTP id 2B59F15BC6007; Sat, 17 Jul 2010 11:07:49 +0200 (CEST) Received: from [78.43.204.177] (helo=frosties.localdomain) by smtp07.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #4) id 1Oa3N6-0001sj-00; Sat, 17 Jul 2010 11:07:48 +0200 Received: from mrvn by frosties.localdomain with local (Exim 4.72) (envelope-from ) id 1Oa3N6-0006N8-AP; Sat, 17 Jul 2010 11:07:48 +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> <201007152319.10974.toots@rastageeks.org> <871vb3bmrd.fsf@frosties.localdomain> <201007160820.37108.toots@rastageeks.org> Date: Sat, 17 Jul 2010 11:07:48 +0200 In-Reply-To: <201007160820.37108.toots@rastageeks.org> (Romain Beauxis's message of "Fri, 16 Jul 2010 08:20:36 -0500") Message-ID: <87lj9a79y3.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: V01U2FsdGVkX18Yp+O7oxQ6a6jG2VzQ3am+7CJZ4b+OhTO5W/5u /LEsFqEncgnOzidk+qSxXPbiHwrJIc7oDqqsLZvL2urzswOJDA 5iosy8QcY= X-Spam: no; 0.00; hashtbl:01 10,:98 mfg:98 threads:01 threads:01 caml-list:01 writes:01 structures:02 implemented:02 vendredi:03 checksum:04 computing:05 implement:06 shared:06 ecrit:06 Romain Beauxis writes: > Le vendredi 16 juillet 2010 08:05:10, vous avez écrit : >> > Now, the main thread does not need to be a task.. >> >> But then how does the main thread notice when a checksum is finished >> computing? The information has to flow both ways. > > I would say its implemented in the replay_request function. You can think of > many structures, a shared Hashtbl, message sending.. The loop in the main > thread can send tasks and check for completed tasks as well... > > > Romain 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. MfG Goswin