English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Smart ways to implement worker threads
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-07-16 (04:02)
From: Goswin von Brederlow <goswin-v-b@w...>
Subject: Re: [Caml-list] Smart ways to implement worker threads
Rich Neswold <rich.neswold@gmail.com> writes:

> On Thu, Jul 15, 2010 at 1:24 PM, Goswin von Brederlow <goswin-v-b@web.de>
> 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.