Exemplo n.º 1
0
            /// Attempts to acquire ownership of the \a recursive_mutex.
            /// Never blocks.
            ///
            /// \returns \a true if ownership was acquired; otherwise, \a false.
            ///
            /// \throws Never throws.
            bool try_lock()
            {
                thread_id_type const id = thread_id_from_mutex<Mutex>::call();
                HPX_ASSERT(id != thread_id_from_mutex<Mutex>::invalid_id());

                return try_recursive_lock(id) || try_basic_lock(id);
            }
Exemplo n.º 2
0
    bool recursive_mutex::timed_lock(::boost::system_time const& wait_until)
    {
        threads::thread_id_type const current_thread_id = threads::get_self_id();

        return try_recursive_lock(current_thread_id) ||
            try_timed_lock(current_thread_id, wait_until);
    }
Exemplo n.º 3
0
    bool recursive_mutex::try_lock()
    {
        threads::thread_id_type const current_thread_id = threads::get_self_id();

        return try_recursive_lock(current_thread_id) ||
            try_basic_lock(current_thread_id);
    }
Exemplo n.º 4
0
 void lock()
 {
     long const current_thread_id=win32::GetCurrentThreadId();
     if(!try_recursive_lock(current_thread_id))
     {
         mutex.lock();
         BOOST_INTERLOCKED_EXCHANGE(&locking_thread_id,current_thread_id);
         recursion_count=1;
     }
 }
Exemplo n.º 5
0
    void recursive_mutex::lock()
    {
        threads::thread_id_type const current_thread_id = threads::get_self_id();

        if (!try_recursive_lock(current_thread_id))
        {
            mtx.lock();
            locking_thread_id.exchange(current_thread_id);
            recursion_count = 1;
        }
    }
Exemplo n.º 6
0
            /// Acquires ownership of the \a recursive_mutex. Suspends the
            /// current HPX-thread if ownership cannot be obtained immediately.
            ///
            /// \throws Throws \a hpx#bad_parameter if an error occurs while
            ///         suspending. Throws \a hpx#yield_aborted if the mutex is
            ///         destroyed while suspended. Throws \a hpx#null_thread_id if
            ///         called outside of a HPX-thread.
            void lock()
            {
                thread_id_type const id = thread_id_from_mutex<Mutex>::call();
                HPX_ASSERT(id != thread_id_from_mutex<Mutex>::invalid_id());

                if (!try_recursive_lock(id))
                {
                    mtx.lock();
                    locking_thread_id.exchange(id);
                    util::ignore_lock(&mtx);
                    util::register_lock(this);
                    recursion_count.store(1);
                }
            }
Exemplo n.º 7
0
 bool try_lock_until(const chrono::time_point<Clock, Duration>& t)
 {
         long const current_thread_id=win32::GetCurrentThreadId();
         return try_recursive_lock(current_thread_id) || try_timed_lock_until(current_thread_id,t);
 }
Exemplo n.º 8
0
 bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
 {
         long const current_thread_id=win32::GetCurrentThreadId();
         return try_recursive_lock(current_thread_id) || try_timed_lock_for(current_thread_id,rel_time);
 }
Exemplo n.º 9
0
 bool timed_lock(::pdalboost::system_time const& target)
 {
     long const current_thread_id=win32::GetCurrentThreadId();
     return try_recursive_lock(current_thread_id) || try_timed_lock(current_thread_id,target);
 }
Exemplo n.º 10
0
 bool try_lock()
 {
     long const current_thread_id=win32::GetCurrentThreadId();
     return try_recursive_lock(current_thread_id) || try_basic_lock(current_thread_id);
 }
Exemplo n.º 11
0
 bool timed_lock(Duration const& target)
 {
     long const current_thread_id=boost::winapi::GetCurrentThreadId();
     return try_recursive_lock(current_thread_id) || try_timed_lock(current_thread_id,target);
 }