2
0
mirror of https://github.com/boostorg/thread.git synced 2026-02-13 00:42:09 +00:00

merge from develop.

This commit is contained in:
Vicente J. Botet Escriba
2015-09-03 07:28:54 +02:00
29 changed files with 204 additions and 72 deletions

View File

@@ -235,7 +235,7 @@ namespace detail
if (super::closed(lk)) return true;
super::not_empty_.wait(lk);
}
return false;
//return false;
}
///////////////////////////

View File

@@ -21,8 +21,8 @@ namespace boost
template <class T>
class devector
{
typedef vector<T> vector_type;
vector<T> data_;
typedef csbl::vector<T> vector_type;
vector_type data_;
std::size_t front_index_;
BOOST_COPYABLE_AND_MOVABLE(devector)
@@ -58,7 +58,9 @@ namespace boost
}
devector& operator=(BOOST_RV_REF(devector) x)
BOOST_NOEXCEPT_IF(vector<T>::allocator_traits_type::propagate_on_container_move_assignment::value)
#if defined BOOST_THREAD_USES_BOOST_VECTOR
BOOST_NOEXCEPT_IF(vector_type::allocator_traits_type::propagate_on_container_move_assignment::value)
#endif
{
data_ = boost::move(x.data_);
front_index_ = x.front_index_;

View File

@@ -83,10 +83,15 @@ namespace executors
*/
void schedule_one_or_yield()
{
#if 1
if ( ! try_executing_one())
{
this_thread::yield();
}
#else
std::terminate();
//return false;
#endif
}
private:

View File

@@ -68,10 +68,15 @@ namespace executors
*/
void schedule_one_or_yield()
{
#if 1
if ( ! try_executing_one())
{
this_thread::yield();
}
#else
std::terminate();
//return false;
#endif
}
/// loop_executor is not copyable.

View File

@@ -106,6 +106,7 @@ namespace executors
shared_state(Executor& ex)
: ex(ex), thr(&shared_state::worker_thread, this)
{
//std::terminate();
}
/**
* \b Effects: Destroys the thread pool.

View File

@@ -53,7 +53,7 @@ BOOST_THREAD_INLINE_NAMESPACE(v2)
throw;
}
#if defined BOOST_THREAD_TASK_REGION_HAS_SHARED_CANCELED
catch (task_canceled_exception& ex)
catch (task_canceled_exception&)
{
}
#endif

View File

@@ -991,9 +991,10 @@ namespace boost
class future_waiter
{
struct registered_waiter;
public:
typedef std::vector<int>::size_type count_type;
private:
struct registered_waiter;
struct registered_waiter
{
boost::shared_ptr<detail::shared_state_base> future_;
@@ -1132,7 +1133,7 @@ namespace boost
#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
template<typename F1,typename F2>
typename boost::enable_if<is_future_type<F1>,unsigned>::type wait_for_any(F1& f1,F2& f2)
typename boost::enable_if<is_future_type<F1>,typename detail::future_waiter::count_type>::type wait_for_any(F1& f1,F2& f2)
{
detail::future_waiter waiter;
waiter.add(f1);
@@ -1141,7 +1142,7 @@ namespace boost
}
template<typename F1,typename F2,typename F3>
unsigned wait_for_any(F1& f1,F2& f2,F3& f3)
typename detail::future_waiter::count_type wait_for_any(F1& f1,F2& f2,F3& f3)
{
detail::future_waiter waiter;
waiter.add(f1);
@@ -1151,7 +1152,7 @@ namespace boost
}
template<typename F1,typename F2,typename F3,typename F4>
unsigned wait_for_any(F1& f1,F2& f2,F3& f3,F4& f4)
typename detail::future_waiter::count_type wait_for_any(F1& f1,F2& f2,F3& f3,F4& f4)
{
detail::future_waiter waiter;
waiter.add(f1);
@@ -1162,7 +1163,7 @@ namespace boost
}
template<typename F1,typename F2,typename F3,typename F4,typename F5>
unsigned wait_for_any(F1& f1,F2& f2,F3& f3,F4& f4,F5& f5)
typename detail::future_waiter::count_type wait_for_any(F1& f1,F2& f2,F3& f3,F4& f4,F5& f5)
{
detail::future_waiter waiter;
waiter.add(f1);
@@ -1174,7 +1175,8 @@ namespace boost
}
#else
template<typename F1, typename... Fs>
typename boost::enable_if<is_future_type<F1>, unsigned>::type wait_for_any(F1& f1, Fs&... fs)
typename boost::enable_if<is_future_type<F1>, typename detail::future_waiter::count_type>::type
wait_for_any(F1& f1, Fs&... fs)
{
detail::future_waiter waiter;
waiter.add(f1, fs...);
@@ -3593,8 +3595,8 @@ namespace detail
));
} else {
std::terminate();
BOOST_THREAD_FUTURE<R> ret;
return ::boost::move(ret);
//BOOST_THREAD_FUTURE<R> ret;
//return ::boost::move(ret);
}
}
@@ -3617,12 +3619,12 @@ namespace detail
return ::boost::move(ret);
} else if (underlying_cast<int>(policy) & int(launch::deferred)) {
std::terminate();
BOOST_THREAD_FUTURE<R> ret;
return ::boost::move(ret);
//BOOST_THREAD_FUTURE<R> ret;
//return ::boost::move(ret);
} else {
std::terminate();
BOOST_THREAD_FUTURE<R> ret;
return ::boost::move(ret);
//BOOST_THREAD_FUTURE<R> ret;
//return ::boost::move(ret);
}
}
#endif
@@ -3657,8 +3659,8 @@ namespace detail
));
} else {
std::terminate();
BOOST_THREAD_FUTURE<R> ret;
return ::boost::move(ret);
//BOOST_THREAD_FUTURE<R> ret;
//return ::boost::move(ret);
}
}
@@ -3682,8 +3684,8 @@ namespace detail
return ::boost::move(ret);
} else if (underlying_cast<int>(policy) & int(launch::deferred)) {
std::terminate();
BOOST_THREAD_FUTURE<R> ret;
return ::boost::move(ret);
//BOOST_THREAD_FUTURE<R> ret;
//return ::boost::move(ret);
// return boost::detail::make_future_deferred_shared_state<Rp>(
// BF(
// thread_detail::decay_copy(boost::forward<F>(f))
@@ -3691,8 +3693,8 @@ namespace detail
// );
} else {
std::terminate();
BOOST_THREAD_FUTURE<R> ret;
return ::boost::move(ret);
//BOOST_THREAD_FUTURE<R> ret;
//return ::boost::move(ret);
}
}
#endif // defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)

View File

@@ -31,7 +31,7 @@ namespace boost
//]
//[poly_lockable
class poly_lockable : public basic_poly_lockable<Lockable>
class poly_lockable : public basic_poly_lockable
{
public:
@@ -41,7 +41,7 @@ namespace boost
//]
//[timed_poly_lockable
class timed_poly_lockable: public poly_lockable<TimedLock>
class timed_poly_lockable: public poly_lockable
{
public:
virtual ~timed_poly_lockable()=0;

View File

@@ -214,7 +214,7 @@ namespace boost
thread_detail::commit_once_region(flag);
}
}
#if !(defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5130))
template<typename Function>
inline void call_once(once_flag& flag, BOOST_THREAD_RV_REF(Function) f)
{
@@ -302,7 +302,7 @@ namespace boost
}
}
#endif // __SUNPRO_CC
#endif
}

View File

@@ -28,6 +28,7 @@
namespace boost
{
typedef shared_mutex shared_timed_mutex;
namespace sync
{
#ifdef BOOST_THREAD_NO_AUTO_DETECT_MUTEX_TYPES

View File

@@ -46,7 +46,7 @@ namespace boost
unsigned const create_event_manual_reset = 0x00000001;
unsigned const event_all_access = EVENT_ALL_ACCESS;
unsigned const semaphore_all_access = SEMAPHORE_ALL_ACCESS;
# ifdef BOOST_NO_ANSI_APIS
# if BOOST_USE_WINAPI_VERSION < BOOST_WINAPI_VERSION_VISTA
@@ -59,7 +59,7 @@ namespace boost
using ::CreateSemaphoreExW;
# endif
using ::OpenEventW;
using ::GetModuleGandleW;
using ::GetModuleHandleW;
# else
using ::CreateMutexA;
using ::CreateEventA;
@@ -79,8 +79,8 @@ namespace boost
using ::ReleaseSemaphore;
using ::SetEvent;
using ::ResetEvent;
using ::WaitForMultipleObjectsEx;
using ::WaitForSingleObjectEx;
using ::WaitForMultipleObjectsEx;
using ::WaitForSingleObjectEx;
using ::GetCurrentProcessId;
using ::GetCurrentThreadId;
using ::GetCurrentThread;
@@ -91,7 +91,7 @@ namespace boost
using ::Sleep;
using ::QueueUserAPC;
using ::GetProcAddress;
#endif
#endif
}
}
}
@@ -286,7 +286,7 @@ namespace boost
}
// Oops, we weren't called often enough, we're stuck
return 0xFFFFFFFF;
return 0xFFFFFFFF;
}
#else
#endif
@@ -295,12 +295,12 @@ namespace boost
static detail::gettickcount64_t gettickcount64impl;
if(gettickcount64impl)
return gettickcount64impl;
// GetTickCount and GetModuleHandle are not allowed in the Windows Runtime,
// and kernel32 isn't used in Windows Phone.
#if BOOST_PLAT_WINDOWS_RUNTIME
gettickcount64impl = &GetTickCount64;
#else
#else
farproc_t addr=GetProcAddress(
#if !defined(BOOST_NO_ANSI_APIS)
GetModuleHandleA("KERNEL32.DLL"),
@@ -312,7 +312,7 @@ namespace boost
gettickcount64impl=(detail::gettickcount64_t) addr;
else
gettickcount64impl=&GetTickCount64emulation;
#endif
#endif
return gettickcount64impl;
}
@@ -343,14 +343,14 @@ namespace boost
handle const res = win32::CreateEventW(0, type, state, mutex_name);
#else
handle const res = win32::CreateEventExW(
0,
mutex_name,
0,
mutex_name,
type ? create_event_manual_reset : 0 | state ? create_event_initial_set : 0,
event_all_access);
#endif
return res;
}
inline handle create_anonymous_event(event_type type,initial_event_state state)
{
handle const res = create_event(0, type, state);
@@ -374,7 +374,7 @@ namespace boost
#endif
return res;
}
inline handle create_anonymous_semaphore(long initial_count,long max_count)
{
handle const res=create_anonymous_semaphore_nothrow(initial_count,max_count);
@@ -402,20 +402,20 @@ namespace boost
{
BOOST_VERIFY(ReleaseSemaphore(semaphore,count,0)!=0);
}
inline void get_system_info(system_info *info)
{
#if BOOST_PLAT_WINDOWS_RUNTIME
win32::GetNativeSystemInfo(info);
win32::GetNativeSystemInfo(info);
#else
win32::GetSystemInfo(info);
#endif
}
inline void sleep(unsigned long milliseconds)
{
if(milliseconds == 0)
{
{
#if BOOST_PLAT_WINDOWS_RUNTIME
std::this_thread::yield();
#else
@@ -425,13 +425,13 @@ namespace boost
else
{
#if BOOST_PLAT_WINDOWS_RUNTIME
::boost::detail::win32::WaitForSingleObjectEx(::boost::detail::win32::GetCurrentThread(), milliseconds, 0);
::boost::detail::win32::WaitForSingleObjectEx(::boost::detail::win32::GetCurrentThread(), milliseconds, 0);
#else
::boost::detail::win32::Sleep(milliseconds);
#endif
}
}
#if BOOST_PLAT_WINDOWS_RUNTIME
class BOOST_THREAD_DECL scoped_winrt_thread
{
@@ -639,7 +639,7 @@ namespace boost
}
old=current;
}
while(true);
while(true) ;
return (old&value)!=0;
}
@@ -656,7 +656,7 @@ namespace boost
}
old=current;
}
while(true);
while(true) ;
return (old&value)!=0;
}
}