[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

synchronization in inferno

The channel is the synchronization primitive.

When you try to put something into a channel, you stop
until some other thread is ready to take it.
At that point, both threads are simultaneously at
specific locations, thus are synchronized.
You get to pass arbitrary data down the channel, too.

One can implement any normal synchronization primitives
with channels (and sometimes extra threads).  Mutexes,
for example, involve an extra thread of execution,
and are therefore rather clunky, but you'll find that
you don't really *want* mutexes too often after you
learn the programming style.