hphp/runtime/base/concurrent-shared-store.cpp
/**
 * The Map::accessor here establishes a write lock, which means that other
 * threads, protected by read locks through Map::const_accessor, will not
 * read erased values from APC.
 * The ReadLock here is to sync with clear(), which only has a WriteLock,
 * not a specific accessor.
 */
The Map::accessor here establishes a write lock, which means that other
threads, protected by read locks through Map::const_accessor, will not
read erased values from APC.
The ReadLock here is to sync with clear(), which only has a WriteLock,
not a specific accessor.
The Map :: accessor here establishes a write lock which means that other threads protected by read locks through Map :: const_accessor will not read erased values from APC . The ReadLock here is to sync with clear () which only has a WriteLock not a specific accessor .
bool ConcurrentTableSharedStore::eraseImpl(const String& key, bool expired) {
  if (key.isNull()) return false;
  ConditionalReadLock l(m_lock, !apcExtension::ConcurrentTableLockFree ||
                                m_lockingFlag);
  Map::accessor acc;
  if (m_vars.find(acc, tagStringData(key.get()))) {
    if (expired && !acc->second.expired()) {
      return false;
    }
    if (acc->second.inMem()) {
      acc->second.var->unreferenceRoot();
    } else {
      assert(acc->second.inFile());
      assert(acc->second.expiry == 0);
    }
    if (expired && acc->second.inFile()) {
      acc->second.var = nullptr;
      acc->second.size = 0;
      acc->second.expiry = 0;
    } else {
      eraseAcc(acc);
    }
    return true;
  }
  return false;
}
bool ConcurrentTableSharedStore :: eraseImpl ( const String & key , bool expired ) { if ( key . isNull ( ) ) return false ; ConditionalReadLock l ( m_lock , ! apcExtension :: ConcurrentTableLockFree || m_lockingFlag ) ; Map :: accessor acc ; if ( m_vars . find ( acc , tagStringData ( key . get ( ) ) ) ) { if ( expired && ! acc -> second . expired ( ) ) { return false ; } if ( acc -> second . inMem ( ) ) { acc -> second . var -> unreferenceRoot ( ) ; } else { assert ( acc -> second . inFile ( ) ) ; assert ( acc -> second . expiry == 0 ) ; } if ( expired && acc -> second . inFile ( ) ) { acc -> second . var = nullptr ; acc -> second . size = 0 ; acc -> second . expiry = 0 ; } else { eraseAcc ( acc ) ; } return true ; } return false ; }
The Map::accessor here establishes a write lock, which means that other
 threads, protected by read locks through Map::const_accessor, will not
 read erased values from APC.
The Map :: accessor here establishes a write lock which means that other threads protected by read locks through Map :: const_accessor will not read erased values from APC .
// a primed key expired, do not erase the table entry