Closed
Bug 677685
Opened 13 years ago
Closed 13 years ago
Implement CompareAndSwapPointers
Categories
(Core :: General, defect)
Core
General
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: dzbarsky, Unassigned)
Details
Attachments
(1 file, 2 obsolete files)
8.04 KB,
patch
|
Details | Diff | Splinter Review |
No description provided.
Comment 1•13 years ago
|
||
dzbarsky, does this do what you want?
Attachment #551883 -
Flags: feedback?
Updated•13 years ago
|
Attachment #551883 -
Flags: feedback? → feedback?(dzbarsky)
Updated•13 years ago
|
Attachment #551883 -
Attachment is patch: true
Reporter | ||
Comment 2•13 years ago
|
||
Looks good, but try to avoid code duplications with js_CompareAndSwap.
Reporter | ||
Updated•13 years ago
|
Attachment #551883 -
Flags: feedback?(dzbarsky) → feedback+
Comment 3•13 years ago
|
||
I'd originally had this in mfbt, but I took it out because I wanted to be able to use mozilla::Mutex. But in a newer version of the patch (which I'll attach in a moment), I'm no longer using a static mozilla::Mutex because it leaks, and it's hard to instantiate a mutex without allocating any memory (which is necessary for bug 670967).
bsmedberg, What would you think about moving this code into mfbt?
Comment 4•13 years ago
|
||
(In reply to David Zbarsky from comment #2)
> Looks good, but try to avoid code duplications with js_CompareAndSwap.
Looking at this more closely, I'm not sure it makes much sense to try to de-duplicate here. It's a small amount of code, and js_CompareAndSwap's interface is different.
We could still move it to mfbt if we wanted...
David, do you have pointers, or jsword's? If you have jswords, you'll have to do some nasty casting to make things work with this interface -- the whole point was to avoid this.
Reporter | ||
Comment 5•13 years ago
|
||
Unfortunately they're jswords. I couldn't get this to work even with the nasty casting.
Comment 6•13 years ago
|
||
This apparently doesn't help David after all. WONTFIX.
Updated•13 years ago
|
Reporter | ||
Comment 7•13 years ago
|
||
Justin, I think your MSVC implementations are wrong. Shouldn't the argument to InterlockedCompareExchange be in the opposite order? See http://msdn.microsoft.com/en-us/library/ms683560%28v=vs.85%29.aspx
Comment 8•13 years ago
|
||
Oh man, and I even had it right in the 64-bit version!
Thanks for noticing, David!
Updated•13 years ago
|
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
Comment 9•13 years ago
|
||
Updated•13 years ago
|
Attachment #551883 -
Attachment is obsolete: true
Comment 10•13 years ago
|
||
Updated•13 years ago
|
Attachment #567010 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•