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-17 (14:20)
From: Romain Beauxis <toots@r...>
Subject: Re: [Caml-list] Smart ways to implement worker threads
Le samedi 17 juillet 2010 05:52:31, Goswin von Brederlow a écrit :
> Now I have a queue that I can include in select. The take function can
> be used by the worker threads. The main thread can use either take_all
> or process to save on syscalls or stick with take to ensure the queue
> does not starve the other FDs.
> Also I think I can use the EventFD to terminate a queue and wake up all
> listeners. Closing the EventFD should wake up any thread stuck in read
> and prevent any threads from becoming stuck in the future. Haven't
> tested that yet though.

I don't see why you want to use EventFD and not Condition.wait/signal. In 
particular, Condition.broadcast does exactly the last thing you mention.

Now, I don't understand why you asked for related modules and and the end 
discard all of them and post your own implementation. Your issue is not that 
complex you could have done that in the first place...