threadsafe_stack& operator=(threadsafe_stack const& other) noexcept
 {
     std::lock(this->m, other.m);
     std::lock_guard<TT> lockThis(this->m, std::adopt_lock);
     std::lock_guard<TT> lockOther(other.m, std::adopt_lock);
     data = other.data;
 }
예제 #2
0
    void Lock::DBWrite::lockDB(const string& ns) {
        fassert( 16253, !ns.empty() );

        Acquiring a(this, *_lockState);
        _locked_W=false;
        _locked_w=false; 
        _weLocked=0;

        massert(16186, "can't get a DBWrite while having a read lock", !_lockState->hasAnyReadLock());
        if (_lockState->isW())
            return;

        StringData db = nsToDatabaseSubstring( ns );
        Nestable nested = n(db);
        if( nested == admin ) { 
            // we can't nestedly lock both admin and local as implemented. so lock_W.
            qlk.lock_W(_lockState);
            _locked_W = true;
            return;
        } 
        if( !nested )
            lockOther(db);
        lockTop();
        if( nested )
            lockNestable(nested);
    }
예제 #3
0
    void Lock::DBWrite::lockDB(const string& ns, const string &context) {
        fassert( 16253, !ns.empty() );
        LockState& ls = lockState();
        
        Acquiring a(this,ls);
        _locked_W=false;
        _locked_w=false; 
        _weLocked=0;


        massert( 16186 , "can't get a DBWrite while having a read lock" , ! ls.hasAnyReadLock() );
        if( ls.isW() )
            return;

        if (DB_LEVEL_LOCKING_ENABLED) {
            StringData db = nsToDatabaseSubstring( ns );
            Nestable nested = n(db);
            if( nested == admin ) { 
                // we can't nestedly lock both admin and local as implemented. so lock_W.
                qlk.lock_W();
                _locked_W = true;
                return;
            } 
            if( !nested )
                lockOther(db, context);
            lockTop(ls);
            if( nested )
                lockNestable(nested, context);
        } 
        else {
            qlk.lock_W();
            _locked_w = true;
        }
    }
예제 #4
0
    void Lock::DBRead::lockDB(const string& ns) {
        fassert( 16254, !ns.empty() );
        LockState& ls = lockState();
        
        Acquiring a(this,ls);
        _locked_r=false; 
        _weLocked=0; 

        if ( ls.isRW() )
            return;
        if (DB_LEVEL_LOCKING_ENABLED) {
            char db[MaxDatabaseNameLen];
            nsToDatabase(ns.data(), db);
            Nestable nested = n(db);
            if( !nested )
                lockOther(db);
            lockTop(ls);
            if( nested )
                lockNestable(nested);
        } 
        else {
            qlk.lock_R();
            _locked_r = true;
        }
    }
예제 #5
0
파일: SkPDFTypes.cpp 프로젝트: 3rdexp/soui
void SkPDFDict::mergeFrom(const SkPDFDict& other) {
    SkAutoMutexAcquire lockOther(other.fMutex);
    SkTDArray<Rec> copy(other.fValue);
    lockOther.release();  // Do not hold both mutexes at once.

    SkAutoMutexAcquire lock(fMutex);
    for (int i = 0; i < copy.count(); i++) {
        *(fValue.append()) = Rec(SkRef(copy[i].key), SkRef(copy[i].value));
    }
}
예제 #6
0
    void Lock::DBRead::lockDB(const string& ns) {
        fassert( 16254, !ns.empty() );

        Acquiring a(this, *_lockState);
        _locked_r=false; 
        _weLocked=0; 

        if (_lockState->isRW())
            return;

        StringData db = nsToDatabaseSubstring(ns);
        Nestable nested = n(db);
        if( !nested )
            lockOther(db);
        lockTop();
        if( nested )
            lockNestable(nested);
    }
예제 #7
0
    void Lock::DBRead::lockDB(const string& ns, const string &context) {
        fassert( 16254, !ns.empty() );
        LockState& ls = lockState();
        
        Acquiring a(this,ls);
        _locked_r=false; 
        _weLocked=0; 

        if ( ls.isRW() )
            return;
        if (DB_LEVEL_LOCKING_ENABLED) {
            StringData db = nsToDatabaseSubstring(ns);
            Nestable nested = n(db);
            if( !nested )
                lockOther(db, context);
            lockTop(ls);
            if( nested )
                lockNestable(nested, context);
        } 
        else {
            qlk.lock_R();
            _locked_r = true;
        }
    }
예제 #8
0
ConnectionConfig& ConnectionConfig::operator=(const ConnectionConfig& other)
{
  bool allowedCopyRect;
  unsigned char preferredEncoding;
  bool use8BitColor;
  int customCompressionLevel;
  int jpegCompressionLevel;
  bool viewOnly;
  bool isClipboardEnabled;
  bool useFullscreen;
  bool deiconifyOnRemoteBell;
  int scaleNumerator;
  int scaleDenominator;
  bool swapMouse;
  bool requestSharedSession;
  bool fitWindow;
  bool requestShapeUpdates;
  bool ignoreShapeUpdates;
  int localCursor;

  {
    AutoLock lockOther(&other.m_cs);
    allowedCopyRect = other.m_allowedCopyRect;
    preferredEncoding = other.m_preferredEncoding;
    use8BitColor = other.m_use8BitColor;
    customCompressionLevel = other.m_customCompressionLevel;
    jpegCompressionLevel = other.m_jpegCompressionLevel;
    viewOnly = other.m_viewOnly;
    isClipboardEnabled = other.m_isClipboardEnabled;
    useFullscreen = other.m_useFullscreen;
    deiconifyOnRemoteBell = other.m_deiconifyOnRemoteBell;
    scaleNumerator = other.m_scaleNumerator;
    scaleDenominator = other.m_scaleDenominator;
    swapMouse = other.m_swapMouse;
    requestSharedSession = other.m_requestSharedSession;
    fitWindow = other.m_fitWindow;
    requestShapeUpdates = other.m_requestShapeUpdates;
    ignoreShapeUpdates = other.m_ignoreShapeUpdates;
    localCursor = other.m_localCursor;
  }

  {
    AutoLock lockThis(&m_cs);
    m_allowedCopyRect = allowedCopyRect;
    m_preferredEncoding = preferredEncoding;
    m_use8BitColor = use8BitColor;
    m_customCompressionLevel = customCompressionLevel;
    m_jpegCompressionLevel = jpegCompressionLevel;
    m_viewOnly = viewOnly;
    m_isClipboardEnabled = isClipboardEnabled;
    m_useFullscreen = useFullscreen;
    m_deiconifyOnRemoteBell = deiconifyOnRemoteBell;
    m_scaleNumerator = scaleNumerator;
    m_scaleDenominator = scaleDenominator;
    m_swapMouse = swapMouse;
    m_requestSharedSession = requestSharedSession;
    m_fitWindow = fitWindow;
    m_requestShapeUpdates = requestShapeUpdates;
    m_ignoreShapeUpdates = ignoreShapeUpdates;
    m_localCursor = localCursor;
  }
  return *this;
}