[Haskell-cafe] Using tiny (atomic) mutables between multiple threads

Belka lambda-belka at yandex.ru
Mon Sep 14 00:05:26 EDT 2009

Thank you, Bulat, for both your suggestions!

1. Since Haskell uses 1 byte for Bool (I confidently guess) and it's safe,
it would also be safe to use <IORef Word8>. Moreover, I found 
your module  and  http://www.haskell.org/haskellwiki/Library/ArrayRef the
corresponding article in HaskellWiki , so I plan to use <IOURef Word8>. I
wonder, however, what's the difference between <Foreign.Ptr Word8> and
<IORef Word8> (or <IOURef Word8>)?

2. As for architecture, I'm not sure that understood the whole suggestion,
but got inspired for new ideas for sure! :) 
My thread's iterations mostly are to acquire resource from load-balancers'
chans, and then to react on outer world state changes - networking and DB. I
put all the blocking operations to be stoppable by LoopBreaker. There's no
real need in job production/execution separation (in most cases) for now (I
guess my architecture is not yet mature enough to consist of generalized
workers and small business-concept-specific initiative sources; my threads
still are very specific to what they are meant to), but I am in need of good
resources production/utilization separation. 
Now in a better architecture I could exchange [stopableThreadDelays between
iterations of threads] on [timely sending the LoopBreaker through Chans
alone or together with resources (like network handle or the load balancer's
permission)]... This way I would definitely minimize some repeating patterns
in code, minimize load on LoopBreaker itself, centralize my timing and
configuration application management and simplify some resource management
processes (like acquiring network handle, when it's required).
Added in a ToDo list for next version!.. =)

Thanks again! 
View this message in context: http://www.nabble.com/Using-tiny-%28atomic%29-mutables-between-multiple-threads-tp25420972p25430039.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list