Beispiel #1
0
 explicit scoped_lock(detail::moved_object<upgradable_lock<Mutex> > upgr)
    : mp_mutex(0), m_locked(false)
 {
    upgradable_lock<mutex_type> &u_lock = upgr.get();
    if(u_lock.owns()){
       u_lock.mutex()->unlock_upgradable_and_lock();
       m_locked = true;
    }
    mp_mutex = u_lock.release();
 }
 upgradable_lock(detail::moved_object<scoped_lock<mutex_type> > scop)
    : mp_mutex(0), m_locked(false)
 {
    scoped_lock<mutex_type> &u_lock = scop.get();
    if(u_lock.owns()){
       u_lock.mutex()->unlock_and_lock_upgradable();
       m_locked = true;
    }
    mp_mutex = u_lock.release();
 }
   static void construct(const NodePtr &ptr, detail::moved_object<std::pair<Convertible1, Convertible2> > value)
   {
      typedef typename Node::hook_type                hook_type;
      typedef typename Node::value_type::first_type   first_type;
      typedef typename Node::value_type::second_type  second_type;
      Node *nodeptr = detail::get_pointer(ptr);

      //Hook constructor does not throw
      new(static_cast<hook_type*>(nodeptr))hook_type();
      //Now construct pair members_holder
      value_type *valueptr = &nodeptr->get_data();
      new((void*)&valueptr->first) first_type(detail::move_impl(value.get().first));
      BOOST_TRY{
         new((void*)&valueptr->second) second_type(detail::move_impl(value.get().second));
      }
      BOOST_CATCH(...){
         valueptr->first.~first_type();
         static_cast<hook_type*>(nodeptr)->~hook_type();
         BOOST_RETHROW
      }
 upgradable_lock( detail::moved_object<sharable_lock<mutex_type> > shar
                , detail::try_to_lock_type)
    : mp_mutex(0), m_locked(false)
 {
    sharable_lock<mutex_type> &s_lock = shar.get();
    if(s_lock.owns()){
       if((m_locked = s_lock.mutex()->try_unlock_sharable_and_lock_upgradable()) == true){
          mp_mutex = s_lock.release();
       }
    }
    else{
       s_lock.release();
    }
 }
Beispiel #5
0
 scoped_lock(detail::moved_object<upgradable_lock<Mutex> > upgr
            ,boost::posix_time::ptime &abs_time)
    : mp_mutex(0), m_locked(false)
 {
    upgradable_lock<mutex_type> &u_lock = upgr.get();
    if(u_lock.owns()){
       if((m_locked = u_lock.mutex()->timed_unlock_upgradable_and_lock(abs_time)) == true){
          mp_mutex = u_lock.release();
       }
    }
    else{
       u_lock.release();
    }
 }
Beispiel #6
0
 scoped_lock(detail::moved_object<upgradable_lock<Mutex> > upgr
            ,try_to_lock_type)
    : mp_mutex(0), m_locked(false)
 {
    upgradable_lock<mutex_type> &u_lock = upgr.get();
    if(u_lock.owns()){
       if((m_locked = u_lock.mutex()->try_unlock_upgradable_and_lock()) == true){
          mp_mutex = u_lock.release();
       }
    }
    else{
       u_lock.release();
    }
 }
 node_alloc_holder(detail::moved_object<ValAlloc> a, const Pred &c) 
    : members_(a.get(), typename ICont::value_compare(c))
 {}
 basic_managed_mapped_file
    (detail::moved_object<basic_managed_mapped_file> moved)
 {  this->swap(moved.get());   }
 void swap(detail::moved_object<upgradable_lock<mutex_type> > other)
 {
    std::swap(mp_mutex, other.get().mp_mutex);
    std::swap(m_locked, other.get().m_locked);
 }
 upgradable_lock(detail::moved_object<upgradable_lock<mutex_type> > upgr)
    : mp_mutex(0), m_locked(upgr.get().owns())
 {  mp_mutex = upgr.get().release(); }
 basic_managed_windows_shared_memory
    (detail::moved_object<basic_managed_windows_shared_memory> &moved)
 {  this->swap(moved.get());   }
Beispiel #12
0
 file_wrapper
    (detail::moved_object<file_wrapper> moved)
 {  this->swap(moved.get());   }
 basic_managed_heap_memory
    (detail::moved_object<basic_managed_heap_memory> &moved)
 {  this->swap(moved.get());   }
Beispiel #14
0
 movable_int(detail::moved_object<movable_int> mmi)
    :  m_int(mmi.get().m_int)
 {  mmi.get().m_int = 0; }
Beispiel #15
0
 scoped_lock(detail::moved_object<scoped_lock<Mutex> > scop)
    : mp_mutex(0), m_locked(scop.get().owns())
 {  mp_mutex = scop.get().release(); }
 basic_managed_external_buffer
 (detail::moved_object<basic_managed_external_buffer> moved)
 {
     this->swap(moved.get());
 }