summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/wtf
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2009-10-27 10:24:07 -0700
committerGrace Kloba <klobag@google.com>2009-10-27 10:24:07 -0700
commit5469794fd9ad86cd03ba4cf7ef0bc82329362f39 (patch)
treedf4f1d669ea401f1576fced087d7af437ea757e9 /JavaScriptCore/wtf
parent228543b5f412cbed35f233c6295661ae5f008269 (diff)
downloadexternal_webkit-5469794fd9ad86cd03ba4cf7ef0bc82329362f39.zip
external_webkit-5469794fd9ad86cd03ba4cf7ef0bc82329362f39.tar.gz
external_webkit-5469794fd9ad86cd03ba4cf7ef0bc82329362f39.tar.bz2
Avoid constructing the MutexLocker class to avoid
two mystery crashes.
Diffstat (limited to 'JavaScriptCore/wtf')
-rw-r--r--JavaScriptCore/wtf/Threading.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/JavaScriptCore/wtf/Threading.h b/JavaScriptCore/wtf/Threading.h
index bbfe8b5..72c242f 100644
--- a/JavaScriptCore/wtf/Threading.h
+++ b/JavaScriptCore/wtf/Threading.h
@@ -259,8 +259,15 @@ public:
#if USE(LOCKFREE_THREADSAFESHARED)
atomicIncrement(&m_refCount);
#else
+#if defined ANDROID // avoid constructing a class to avoid two mystery crashes
+ m_mutex.lock();
+#else
MutexLocker locker(m_mutex);
+#endif
++m_refCount;
+#if defined ANDROID
+ m_mutex.unlock();
+#endif
#endif
}
@@ -287,9 +294,16 @@ protected:
#else
int refCount;
{
+#if defined ANDROID // avoid constructing a class to avoid two mystery crashes
+ m_mutex.lock();
+#else
MutexLocker locker(m_mutex);
+#endif
--m_refCount;
refCount = m_refCount;
+#if defined ANDROID
+ m_mutex.unlock();
+#endif
}
if (refCount <= 0)
return true;