Forum: Ruby sync.rb difference between Sync::UN, Sync::EX and Sync::SH

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
transfire (Guest)
on 2005-12-08 20:55
(Received via mailing list)
In sync.rb what are Sync::UN, Sync::EX and Sync::SH all about?

Thanks,
T.
transfire (Guest)
on 2005-12-08 21:08
(Received via mailing list)
Oh, one other thing. SyncEnumerator has nothing to do with Sync right?
Maybe it would be better if were named something else (TandemEnumerator
come to mind).

Thanks,
T.
vjoel (Guest)
on 2005-12-08 21:24
(Received via mailing list)
Trans wrote:
> In sync.rb what are Sync::UN, Sync::EX and Sync::SH all about?

EX is exclusive: if a thread requests an EX lock, no other threads may
may hold the lock at the same time.

SH is shared: many threads may hold the lock as long as they all
requested a shared lock.

The intent is to allow either multiple readers or a single writer (but
not both) inside the critical section(s) of code.
Trans (Guest)
on 2005-12-12 16:48
(Received via mailing list)
No one know? I assume Sync::EX when underlying data is gogin to change
and Sync::SH when it's not? Can EX just be used alwasy instead?

T.
This topic is locked and can not be replied to.