mirror of
https://github.com/boostorg/thread.git
synced 2026-02-08 23:22:13 +00:00
Fixes and Cleanup
- Fixed build failures on Windows. The timespec struct is not supported by older versions of Visual Studio. I changed the internal representation inside of the *_timespec_timepoint classes to a boost::intmax_t representing the number of nanoseconds since the epoch. - Fixed some functions that wouldn't execute at all if they were provided a negative time duration or an absolute time that was in the past. From what I understand, they should instead execute once and then return immediately. - Moved pthread/timespec.hpp to detail/timespec.hpp. - Deleted detail/internal_clock.hpp and moved the seven relevant lines into detail/timespec.hpp. This keeps all of the internal clock declarations in one place. - Renamed thread_detail::internal_clock_t to detail::internal_chrono_clock to be consistent with and yet clearly differentiated from detail::internal_timespec_clock. - Removed "using namespace chrono" to eliminate ambiguious namespace resolution when referencing detail::internal_chrono_clock. - Re-enabled a few tests on Windows that had previously been disabled. I want to see whether or not they still need to be disabled.
This commit is contained in:
@@ -439,14 +439,15 @@ namespace boost
|
||||
{
|
||||
// Use pthread_delay_np or nanosleep whenever possible here in the no_interruption_point
|
||||
// namespace because they do not provide an interruption point.
|
||||
timespec const& ts2 = ts.getTs();
|
||||
# if defined(BOOST_HAS_PTHREAD_DELAY_NP)
|
||||
# if defined(__IBMCPP__) || defined(_AIX)
|
||||
BOOST_VERIFY(!pthread_delay_np(const_cast<timespec*>(&ts.get())));
|
||||
BOOST_VERIFY(!pthread_delay_np(const_cast<timespec*>(&ts2)));
|
||||
# else
|
||||
BOOST_VERIFY(!pthread_delay_np(&ts.get()));
|
||||
BOOST_VERIFY(!pthread_delay_np(&ts2));
|
||||
# endif
|
||||
# elif defined(BOOST_HAS_NANOSLEEP)
|
||||
nanosleep(&ts.get(), 0);
|
||||
nanosleep(&ts2, 0);
|
||||
# else
|
||||
// Fall back to using a condition variable even though it does provide an interruption point.
|
||||
const detail::internal_timespec_timepoint& ts2 = detail::internal_timespec_clock::now() + ts;
|
||||
|
||||
Reference in New Issue
Block a user