Commit 79728bce authored by eric@webkit.org's avatar eric@webkit.org

2010-01-31 Patrick Gansterer <paroga@paroga.com>

        Reviewed by Darin Adler.

        Buildfix for WinCE + style fixes (TLS_OUT_OF_INDEXES is not defined).
        https://bugs.webkit.org/show_bug.cgi?id=34380

        * wtf/ThreadSpecific.h:

git-svn-id: svn://svn.chromium.org/blink/trunk@54123 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent d455e1d9
2010-01-31 Patrick Gansterer <paroga@paroga.com>
Reviewed by Darin Adler.
Buildfix for WinCE + style fixes (TLS_OUT_OF_INDEXES is not defined).
https://bugs.webkit.org/show_bug.cgi?id=34380
* wtf/ThreadSpecific.h:
2010-01-31 Kent Tamura <tkent@chromium.org>
Reviewed by Darin Adler.
......
......@@ -188,6 +188,11 @@ inline void ThreadSpecific<T>::set(T* ptr)
#elif OS(WINDOWS)
// TLS_OUT_OF_INDEXES is not defined on WinCE.
#ifndef TLS_OUT_OF_INDEXES
#define TLS_OUT_OF_INDEXES 0xffffffff
#endif
// The maximum number of TLS keys that can be created. For simplification, we assume that:
// 1) Once the instance of ThreadSpecific<> is created, it will not be destructed until the program dies.
// 2) We do not need to hold many instances of ThreadSpecific<> data. This fixed number should be far enough.
......@@ -200,14 +205,14 @@ template<typename T>
inline ThreadSpecific<T>::ThreadSpecific()
: m_index(-1)
{
DWORD tls_key = TlsAlloc();
if (tls_key == TLS_OUT_OF_INDEXES)
DWORD tlsKey = TlsAlloc();
if (tlsKey == TLS_OUT_OF_INDEXES)
CRASH();
m_index = InterlockedIncrement(&tlsKeyCount()) - 1;
if (m_index >= kMaxTlsKeySize)
CRASH();
tlsKeys()[m_index] = tls_key;
tlsKeys()[m_index] = tlsKey;
}
template<typename T>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment