Ref method getHistoryCount

1 view
Skip to first unread message

Mark Volkmann

unread,
Sep 2, 2009, 5:59:34 PM9/2/09
to clo...@googlegroups.com
Can someone explain why the getHistoryCount method in Ref.java
acquires a write lock instead of a read lock? I say in my STM article:

"It acquires a write lock instead of a read lock because it walks the
history chain to get the count and needs to prevent other threads from
modifying the chain while it does this."

However, acquiring a read lock would seem to serve the same purpose. I
believe the chain of TVal objects is only modified when the write lock
is held and that can't happen if another thread holds a read lock.

--
R. Mark Volkmann
Object Computing, Inc.

Reply all
Reply to author
Forward
0 new messages