Ejemplo n.º 1
0
 BOOLEAN try_get_shared()
 {
    try
    {
       return _m.timed_lock_shared ( boost::posix_time::milliseconds ( 0 ) ) ;
    }
    catch(...)
    {
       SDB_ASSERT ( FALSE, "SLatch try get shared failed" ) ;
    }
    return FALSE ;
 }
Ejemplo n.º 2
0
void thread3_func_workaround()
{
  while (true)
  {
    if (mutex.timed_lock_shared(boost::posix_time::milliseconds(200)))
    {
      std::cout << "Shared lock acquired" << std::endl
        << "Test successful" << std::endl;
      mutex.unlock_shared();
      break;
    }
    boost::this_thread::sleep(boost::posix_time::milliseconds(100));
  }
}