Ticket #7045: 7045_2.patch
File 7045_2.patch, 3.9 KB (added by , 10 years ago) |
---|
-
boost/thread/detail/thread.hpp
364 364 #endif 365 365 #if defined(BOOST_THREAD_PLATFORM_WIN32) 366 366 bool timed_join(const system_time& abs_time); 367 367 private: 368 bool do_try_join_until(uintmax_t milli); 369 public: 368 370 #ifdef BOOST_THREAD_USES_CHRONO 369 bool try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp); 370 // bool try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp) 371 // { 372 // if (this_thread::get_id() == get_id()) 373 // { 374 // boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); 375 // } 376 // detail::thread_data_ptr local_thread_info=(get_thread_info)(); 377 // if(local_thread_info) 378 // { 379 // chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-chrono::system_clock::now()); 380 // if(!this_thread::interruptible_wait(local_thread_info->thread_handle,rel_time.count())) 381 // { 382 // return false; 383 // } 384 // release_handle(); 385 // } 386 // return true; 387 // } 371 bool try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp) 372 { 373 chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-chrono::system_clock::now()); 374 return do_try_join_until(rel_time.count()); 375 } 388 376 #endif 389 public:390 377 378 391 379 #else 392 380 bool timed_join(const system_time& abs_time) 393 381 { -
libs/thread/src/win32/thread.cpp
318 318 319 319 bool thread::timed_join(boost::system_time const& wait_until) 320 320 { 321 if (this_thread::get_id() == get_id()) 322 { 323 boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); 324 } 325 detail::thread_data_ptr local_thread_info=(get_thread_info)(); 326 if(local_thread_info) 327 { 328 if(!this_thread::interruptible_wait(local_thread_info->thread_handle,get_milliseconds_until(wait_until))) 329 { 330 return false; 331 } 332 release_handle(); 333 } 334 return true; 321 return do_try_join_until(get_milliseconds_until(wait_until)); 335 322 } 336 323 337 #ifdef BOOST_THREAD_USES_CHRONO 338 339 bool thread::try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp) 324 bool thread::do_try_join_until(uintmax_t milli) 340 325 { 341 326 if (this_thread::get_id() == get_id()) 342 327 { 343 boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself"));328 boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); 344 329 } 345 330 detail::thread_data_ptr local_thread_info=(get_thread_info)(); 346 331 if(local_thread_info) 347 332 { 348 chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-chrono::system_clock::now()); 349 if(!this_thread::interruptible_wait(local_thread_info->thread_handle,rel_time.count())) 350 { 351 return false; 352 } 353 release_handle(); 333 if(!this_thread::interruptible_wait(local_thread_info->thread_handle,milli)) 334 { 335 return false; 336 } 337 release_handle(); 354 338 } 355 339 return true; 356 340 } 357 341 358 #endif359 360 342 void thread::detach() BOOST_NOEXCEPT 361 343 { 362 344 release_handle();