Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Rich Neswold <rich.neswold@g...>
Subject: Re: [Caml-list] Smart ways to implement worker threads
On Thu, Jul 15, 2010 at 11:02 PM, Goswin von Brederlow <goswin-v-b@web.de>wrote:

> Rich Neswold <rich.neswold@gmail.com> writes:
>
> 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.
>

Channels are a thread-safe communication channel of depth one (i.e. you can
only pass one item at a time.) The channel is a primitive that allows
reliable synchronized communication between threads. The Reppy book
describes in later chapters how to use the channel primitive to build up
queues and other, more complicated constructs (like RPCs and multicasting to
many processes.)

In fact, you might use the RPC ideas to pass your checksumming requests to
worker tasks and receive the results.

-- 
Rich

Google Reader: https://www.google.com/reader/shared/rich.neswold
Jabber ID: rich@neswold.homeunix.net