Ignore:
Timestamp:
Jan 21, 2010, 11:36:29 PM (15 years ago)
Author:
[email protected]
Message:

2010-01-21 Kwang Yul Seo <[email protected]>

Reviewed by Alexey Proskuryakov.

Add ThreadSpecific for ENABLE(SINGLE_THREADED)
https://bugs.webkit.org/show_bug.cgi?id=33878

Implement ThreadSpecific with a simple getter/setter
when ENABLE(SINGLE_THREADED) is true.

Due to the change in https://bugs.webkit.org/show_bug.cgi?id=33236,
an implementation of ThreadSpecific must be available to build WebKit.
This causes a build failure for platforms without a proper
ThreadSpecific implementation.

  • wtf/ThreadSpecific.h: (WTF::::ThreadSpecific): (WTF::::~ThreadSpecific): (WTF::::get): (WTF::::set): (WTF::::destroy):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/ThreadSpecific.h

    r52791 r53682  
    9292#endif
    9393
     94#if ENABLE(SINGLE_THREADED)
     95    T* m_value;
     96#else
    9497#if USE(PTHREADS)
    9598    pthread_key_t m_key;
     
    99102    int m_index;
    100103#endif
     104#endif
    101105};
    102106
     107#if ENABLE(SINGLE_THREADED)
     108template<typename T>
     109inline ThreadSpecific<T>::ThreadSpecific()
     110    : m_value(0)
     111{
     112}
     113
     114template<typename T>
     115inline ThreadSpecific<T>::~ThreadSpecific()
     116{
     117}
     118
     119template<typename T>
     120inline T* ThreadSpecific<T>::get()
     121{
     122    return m_value;
     123}
     124
     125template<typename T>
     126inline void ThreadSpecific<T>::set(T* ptr)
     127{
     128    ASSERT(!get());
     129    m_value = ptr;
     130}
     131#else
    103132#if USE(PTHREADS)
    104133template<typename T>
     
    208237#error ThreadSpecific is not implemented for this platform.
    209238#endif
     239#endif
    210240
    211241template<typename T>
    212242inline void ThreadSpecific<T>::destroy(void* ptr)
    213243{
     244#if !ENABLE(SINGLE_THREADED)
    214245    Data* data = static_cast<Data*>(ptr);
    215246
     
    239270#if !PLATFORM(QT)
    240271    delete data;
     272#endif
    241273#endif
    242274}
Note: See TracChangeset for help on using the changeset viewer.