multithreading - TMVar, but without the buffer? -
i'm trying communication between haskell lightweight threads. threads want send each other messages communication , synchronisation.
i using tmvar
this, i've realised semantics wrong: tmvar
store 1 message in internally, positing message empty tmvar
won't block. it'll block if post message full tmvar
.
can suggest similar stm
ipc construct which:
- will cause writes block until message consumed;
- will cause reads block until message provided?
i.e. zero-length pipe ideal; don't think boundedchan
happy if gave capacity of 0. (also, it's not stm
.)
if understand problem correctly, don't think can, since transactional guarantees mean transaction can't read transaction b's write until transaction b committed, @ point can no longer block.
tmvar
closest you're going if you're using stm. io, may able build structure completes write when reader available (this structure may exist, i'm not aware of it).
Comments
Post a Comment