示例#1
0
void shared_spinlock::lock_upgrade()
{
    unlock_shared();
    lock();
    /*
    long v = m_flag.load();
    for (;;)
    {
        if (v != 1)
        {
            //std::this_thread::yield();
            v = m_flag.load();
        }
        else if (m_flag.compare_exchange_weak(v, min_long))
        {
            return;
        }
        // else: next iteration
    }
    */
}
示例#2
0
void shared_spinlock::lock_upgrade() {
    unlock_shared();
    lock();
}
void shared_spinlock::unlock_upgrade_and_lock() {
  unlock_shared();
  lock();
}