From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 8F340BBAF for ; Fri, 16 Jul 2010 06:02:39 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq4CAJZ2P0zZSMDjkWdsb2JhbACfaxUBAQEBCQsKBxEDH758hSQE X-IronPort-AV: E=Sophos;i="4.55,212,1278280800"; d="scan'208";a="55628682" Received: from fmmailgate02.web.de ([217.72.192.227]) by mail2-smtp-roc.national.inria.fr with ESMTP; 16 Jul 2010 06:02:39 +0200 Received: from smtp07.web.de ( [172.20.5.215]) by fmmailgate02.web.de (Postfix) with ESMTP id 6753E16BFA169; Fri, 16 Jul 2010 06:02:09 +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 1OZc7l-00040R-00; Fri, 16 Jul 2010 06:02:09 +0200 Received: from mrvn by frosties.localdomain with local (Exim 4.72) (envelope-from ) id 1OZc7e-0007tI-R1; Fri, 16 Jul 2010 06:02:02 +0200 From: Goswin von Brederlow To: Rich Neswold Cc: Goswin von Brederlow , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Smart ways to implement worker threads References: <87sk3mcaeq.fsf@frosties.localdomain> <87zkxsfvsg.fsf@frosties.localdomain> Date: Fri, 16 Jul 2010 06:02:02 +0200 In-Reply-To: (Rich Neswold's message of "Thu, 15 Jul 2010 14:56:21 -0500") Message-ID: <87hbk0vzut.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+3cmIqi7uKhJfe+fFsfuzMeJfwIeNaAJwFSNZz /ksrFc5ZXhxkmc9HzJ5LPxFq82WpM2564uzpku60k5nhjPWm7z YeOxaHnwA= X-Spam: no; 0.00; ocaml:01 ocaml:01 ocaml's:01 syntax:01 mfg:98 threads:01 wrote:01 caml-list:01 differs:01 short:01 writes:01 translate:04 jul:05 thu:05 throws:05 Rich Neswold writes: > On Thu, Jul 15, 2010 at 1:24 PM, Goswin von Brederlow > wrote: > > It is too bad I don't want to learn CML but use Ocaml. The CML examples > from the book don't translate into ocaml since the interface is just a > little bit different and those differences are what throws me off. > >   > > So could you give a short example? E.g. the merge sort from the book. > > > You're right: OCaml's syntax differs enough from the text that it's annoying to > cut-n-paste the examples. Fortunately most example are a few lines of code, so > I didn't realize how difficult it could be on a larger example (like the merge > sort example.) > > Attached is my translation of the mergeSort from the book. You get to play with > it and see if it works  :) Thanks. That is about what I got so I do seem to understand the differences right. For my use case this would then come down to implement solution 3 with channels instead of my own queues. Well, channels are thread safe queues just by another name. I think I see now how they make the code simpler to write. MfG Goswin