コード例 #1
0
ファイル: recursive_mutex.hpp プロジェクト: ShmuelLevine/hpx
            /// 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);
            }
コード例 #2
0
ファイル: recursive_mutex.cpp プロジェクト: 41i/hpx
    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);
    }
コード例 #3
0
ファイル: recursive_mutex.cpp プロジェクト: 41i/hpx
    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);
    }
コード例 #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;
     }
 }
コード例 #5
0
ファイル: recursive_mutex.cpp プロジェクト: 41i/hpx
    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;
        }
    }
コード例 #6
0
ファイル: recursive_mutex.hpp プロジェクト: ShmuelLevine/hpx
            /// 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);
                }
            }
コード例 #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);
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #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);
 }
コード例 #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);
 }