From 37747ece0d91b3c206ce2dfda4f6341f276faf3c Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Mon, 5 Jan 2015 19:58:07 +0100 Subject: [PATCH] use fibers::mutext instead std::mutex in workstealing example --- examples/migration/workstealing_round_robin.cpp | 14 +++++++------- examples/migration/workstealing_round_robin.hpp | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/migration/workstealing_round_robin.cpp b/examples/migration/workstealing_round_robin.cpp index f517f6f6..3a75b290 100644 --- a/examples/migration/workstealing_round_robin.cpp +++ b/examples/migration/workstealing_round_robin.cpp @@ -13,18 +13,18 @@ #endif void -workstealing_round_robin::awakened( boost::fibers::detail::fiber_handle & f) +workstealing_round_robin::awakened( boost::fibers::fiber_handle & f) { - std::unique_lock< std::mutex > lk( mtx_); + std::unique_lock< boost::fibers::mutex > lk( mtx_); BOOST_ASSERT( f->is_ready() ); rqueue_.push_back( f); } -boost::fibers::detail::fiber_handle +boost::fibers::fiber_handle workstealing_round_robin::pick_next() { - std::unique_lock< std::mutex > lk( mtx_); - boost::fibers::detail::fiber_handle f; + std::unique_lock< boost::fibers::mutex > lk( mtx_); + boost::fibers::fiber_handle f; if ( ! rqueue_.empty() ) { f = rqueue_.front(); @@ -37,8 +37,8 @@ workstealing_round_robin::pick_next() boost::fibers::fiber workstealing_round_robin::steal() { - std::unique_lock< std::mutex > lk( mtx_); - for ( boost::fibers::detail::fiber_handle f : rqueue_) + std::unique_lock< boost::fibers::mutex > lk( mtx_); + for ( boost::fibers::fiber_handle f : rqueue_) { if ( ! f->thread_affinity() ) { diff --git a/examples/migration/workstealing_round_robin.hpp b/examples/migration/workstealing_round_robin.hpp index b756fde9..27d537de 100644 --- a/examples/migration/workstealing_round_robin.hpp +++ b/examples/migration/workstealing_round_robin.hpp @@ -20,15 +20,15 @@ class workstealing_round_robin : public boost::fibers::sched_algorithm { private: - typedef std::list< boost::fibers::detail::fiber_handle > rqueue_t; + typedef std::list< boost::fibers::fiber_handle > rqueue_t; - std::mutex mtx_; + boost::fibers::mutex mtx_; rqueue_t rqueue_; public: - virtual void awakened( boost::fibers::detail::fiber_handle &); + virtual void awakened( boost::fibers::fiber_handle &); - virtual boost::fibers::detail::fiber_handle pick_next(); + virtual boost::fibers::fiber_handle pick_next(); boost::fibers::fiber steal(); };