Bug 115875 - add atomicAdd and atomicSubtract
Summary: add atomicAdd and atomicSubtract
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Minor
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-09 14:35 PDT by Alex Christensen
Modified: 2013-08-20 09:02 PDT (History)
6 users (show)

See Also:


Attachments
Patch (5.27 KB, patch)
2013-05-09 14:38 PDT, Alex Christensen
benjamin: review-
benjamin: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2013-05-09 14:35:12 PDT
Source/WTF/wtf/Atomics.h currently has atomicIncrement and atomicDecrement for adding and subtracting 1 atomically, but there is no way to add and subtract other values atomically using WTF.  This is needed in cases like Source/WTF/wtf/text/StringImpl.h line 584, which increments a value by 2.

I added atomicAdd and atomicSubtract and tested it on Mac, but I'd prefer someone try this on Windows before reviewing in case I forgot something Windows-specific.
Comment 1 Alex Christensen 2013-05-09 14:38:35 PDT
Created attachment 201278 [details]
Patch
Comment 2 Benjamin Poulain 2013-05-09 14:44:52 PDT
Comment on attachment 201278 [details]
Patch

(In reply to comment #0)
> Source/WTF/wtf/Atomics.h currently has atomicIncrement and atomicDecrement for adding and subtracting 1 atomically, but there is no way to add and subtract other values atomically using WTF.  This is needed in cases like Source/WTF/wtf/text/StringImpl.h line 584, which increments a value by 2.
> 
> I added atomicAdd and atomicSubtract and tested it on Mac, but I'd prefer someone try this on Windows before reviewing in case I forgot something Windows-specific.

StringImpl does not use atomic ref-deref.

What is this for?