⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 118603 in webkit


Ignore:
Timestamp:
May 25, 2012, 8:09:34 PM (14 years ago)
Author:
fpizlo@apple.com
Message:

weakCompareAndSwap should work on Windows
https://bugs.webkit.org/show_bug.cgi?id=87549

Reviewed by Jessie Berlin.

  • wtf/Atomics.h:

(WTF):
(WTF::weakCompareAndSwap):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r118344 r118603  
     12012-05-25  Filip Pizlo  <fpizlo@apple.com>
     2
     3        weakCompareAndSwap should work on Windows
     4        https://bugs.webkit.org/show_bug.cgi?id=87549
     5
     6        Reviewed by Jessie Berlin.
     7
     8        * wtf/Atomics.h:
     9        (WTF):
     10        (WTF::weakCompareAndSwap):
     11
    1122012-05-24  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
    213
  • trunk/Source/WTF/wtf/Atomics.h

    r111778 r118603  
    119119#endif
    120120
     121#if OS(WINDOWS)
     122inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, unsigned newValue)
     123{
     124    return InterlockedCompareExchange(reinterpret_cast<LONG volatile*>(location), static_cast<LONG>(newValue), static_cast<LONG>(expected)) == static_cast<LONG>(expected);
     125}
     126
     127inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* newValue)
     128{
     129    return InterlockedCompareExchangePointer(location, newValue, expected) == expected;
     130}
     131#else // OS(WINDOWS) --> not windows
    121132#if COMPILER(GCC) && !COMPILER(CLANG) // Work around a gcc bug
    122133inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, unsigned newValue)
     
    185196#endif // ENABLE(COMPARE_AND_SWAP)
    186197}
     198#endif // OS(WINDOWS) (end of the not-windows case)
    187199
    188200inline bool weakCompareAndSwapUIntPtr(volatile uintptr_t* location, uintptr_t expected, uintptr_t newValue)
Note: See TracChangeset for help on using the changeset viewer.