Changeset 62765 in webkit


Ignore:
Timestamp:
Jul 8, 2010 12:38:29 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-07-08 Patrick Gansterer <paroga@paroga.com>

Reviewed by Geoffrey Garen.

Make FastMalloc more portable.
https://bugs.webkit.org/show_bug.cgi?id=41790

Use WTF::Mutex instead of pthread_mutex_t and
replace pthread_cond_t with WTF::ThreadCondition.

  • wtf/FastMalloc.cpp: (WTF::TCMalloc_PageHeap::initializeScavenger): (WTF::TCMalloc_PageHeap::signalScavenger): (WTF::TCMalloc_PageHeap::scavengerThread):
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r62764 r62765  
     12010-07-08  Patrick Gansterer  <paroga@paroga.com>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Make FastMalloc more portable.
     6        https://bugs.webkit.org/show_bug.cgi?id=41790
     7
     8        Use WTF::Mutex instead of pthread_mutex_t and
     9        replace pthread_cond_t with WTF::ThreadCondition.
     10
     11        * wtf/FastMalloc.cpp:
     12        (WTF::TCMalloc_PageHeap::initializeScavenger):
     13        (WTF::TCMalloc_PageHeap::signalScavenger):
     14        (WTF::TCMalloc_PageHeap::scavengerThread):
     15
    1162010-07-08  Patrick Gansterer  <paroga@paroga.com>
    217
  • trunk/JavaScriptCore/wtf/FastMalloc.cpp

    r58753 r62765  
    415415#include "TCSpinLock.h"
    416416#include "TCSystemAlloc.h"
     417#include "Threading.h"
     418#include "ThreadSpecific.h"
    417419#include <algorithm>
    418420#include <errno.h>
     
    14431445  bool m_scavengeThreadActive;
    14441446
    1445   pthread_mutex_t m_scavengeMutex;
    1446   pthread_cond_t m_scavengeCondition;
     1447  Mutex m_scavengeMutex;
     1448  ThreadCondition m_scavengeCondition;
    14471449#else // !HAVE(DISPATCH_H)
    14481450  void periodicScavenge();
     
    14901492void TCMalloc_PageHeap::initializeScavenger()
    14911493{
    1492   pthread_mutex_init(&m_scavengeMutex, 0);
    1493   pthread_cond_init(&m_scavengeCondition, 0);
    14941494  m_scavengeThreadActive = true;
    14951495  pthread_t thread;
     
    15091509{
    15101510  if (!m_scavengeThreadActive && shouldScavenge())
    1511     pthread_cond_signal(&m_scavengeCondition);
     1511    m_scavengeCondition.signal();
    15121512}
    15131513
     
    23752375  while (1) {
    23762376      if (!shouldScavenge()) {
    2377           pthread_mutex_lock(&m_scavengeMutex);
     2377          MutexLocker locker(m_scavengeMutex);
    23782378          m_scavengeThreadActive = false;
    23792379          // Block until there are enough free committed pages to release back to the system.
    2380           pthread_cond_wait(&m_scavengeCondition, &m_scavengeMutex);
     2380          m_scavengeCondition.wait(m_scavengeMutex);
    23812381          m_scavengeThreadActive = true;
    2382           pthread_mutex_unlock(&m_scavengeMutex);
    23832382      }
    23842383      sleep(kScavengeDelayInSeconds);
Note: See TracChangeset for help on using the changeset viewer.