Jump to content

Talk:Test and test-and-set

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Christian75 (talk | contribs) at 23:28, 29 June 2015 (Assessment: +Computer science (assisted)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconComputer science Unassessed
WikiProject iconThis article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
???This article has not yet received a rating on Wikipedia's content assessment scale.
???This article has not yet received a rating on the project's importance scale.
Things you can help WikiProject Computer science with:

I don't see how double-checked locking is an example of this. --Apoc2400 05:43, 16 November 2006 (UTC)[reply]

It uses the same pattern of simple checking and then checking and doing the work within a critical section. —The preceding unsigned comment was added by 193.172.180.130 (talk) 09:27, 9 May 2007 (UTC).[reply]
I'm sorry, but I think the unsigned commenter is confused. They do use "the same pattern" in a very broad sense, but it is not this broad pattern that is unsafe.
DCLP is indeed unsafe when used together with singleton (which is the classic use case). The reason for this has to do with the way in which it combines assignment and object construction. Even though it seems like the object construction "should" happen before the pointer assignment, that may not be the order in which the writes become visible to other unsynchronized threads. Since test-and-set changes a scalar value, there is no reordering risk.
The claim that DCLP is an "example of bad usage of this idiom" is, at the very least, not supported by references. --BertD (talk) 18:03, 23 April 2009 (UTC)[reply]
I'm with Bert. It's almost antithetical, when you get down to this. Double Checked locking is different in more ways than just that, in that it checks to try and see if locking is needed, rather than trying to make the check for lock-availability cheaper. They're... I mean, do they have anything in common? —Preceding unsigned comment added by 12.146.21.163 (talk) 00:30, 4 February 2011 (UTC)[reply]