From 3627dfc3b737dfe0a8f7b8d5b945e831567d730e Mon Sep 17 00:00:00 2001 From: "William E. Kempf" Date: Sun, 23 Feb 2003 18:09:27 +0000 Subject: [PATCH] Removed warnings. [SVN r17606] --- build/threads.jam | 1 + include/boost/thread/thread.hpp | 2 +- src/thread.cpp | 13 +++++++------ src/timeconv.inl | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/build/threads.jam b/build/threads.jam index ddf0f6b3..699a840e 100644 --- a/build/threads.jam +++ b/build/threads.jam @@ -33,6 +33,7 @@ : ## requirements ## : $(BOOST_ROOT) multi $(pthreads-win32) + <*>-w-8004 <*>-w-8057 ## default build ## : ; diff --git a/include/boost/thread/thread.hpp b/include/boost/thread/thread.hpp index ca05b6a2..0bfc3225 100644 --- a/include/boost/thread/thread.hpp +++ b/include/boost/thread/thread.hpp @@ -143,7 +143,7 @@ public: #if defined(BOOST_HAS_WINTHREADS) typedef unsigned int id_type; #else - typedef void* id_type; + typedef const void* id_type; #endif id_type id() const; diff --git a/src/thread.cpp b/src/thread.cpp index c5ee837e..6ae0ddd0 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -249,7 +249,7 @@ bool thread_data::timed_join(const boost::xtime& xt) m_state = joining; } - int res = 0; + unsigned int res = 0; #if defined(BOOST_HAS_WINTHREADS) for (;;) { @@ -304,6 +304,7 @@ bool thread_data::timed_join(const boost::xtime& xt) assert(m_state == joining); m_state = joined; m_cond.notify_all(); + return true; } void thread_data::cancel() @@ -404,7 +405,7 @@ void thread_data::set_scheduling_parameter(int policy, if (res == EINVAL) throw boost::invalid_thread_argument(res); if (res == ENOTSUP) - throw unsupported_thread_option(res); + throw boost::unsupported_thread_option(res); if (res == EPERM) throw boost::thread_permission_error(res); assert(res == 0); @@ -569,11 +570,11 @@ thread::attributes& thread::attributes::set_stack_address(void* addr) int res = 0; res = pthread_attr_setstackaddr(&m_attr, addr); assert(res == 0); + return *this; # else throw unsupported_thread_option(ENOTSUP); # endif #endif - return *this; } void* thread::attributes::get_stack_address() const @@ -860,8 +861,8 @@ int thread::max_priority(int policy) #elif defined(BOOST_HAS_PTHREADS) # if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) # endif -#endif return 0; +#endif } int thread::min_priority(int policy) @@ -873,8 +874,8 @@ int thread::min_priority(int policy) #elif defined(BOOST_HAS_PTHREADS) # if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) # endif -#endif return 0; +#endif } void thread::sleep(const xtime& xt) @@ -913,12 +914,12 @@ void thread::sleep(const xtime& xt) AbsoluteTime sWakeTime(DurationToAbsolute(lMicroseconds)); threads::mac::detail::safe_delay_until(&sWakeTime); #endif + thread::test_cancel(); xtime cur; xtime_get(&cur, TIME_UTC); if (xtime_cmp(xt, cur) <= 0) return; } - thread::test_cancel(); } void thread::yield() diff --git a/src/timeconv.inl b/src/timeconv.inl index 001dcccf..fd9f7cbb 100644 --- a/src/timeconv.inl +++ b/src/timeconv.inl @@ -100,7 +100,7 @@ inline void to_duration(boost::xtime xt, int& milliseconds) xt.nsec += NANOSECONDS_PER_SECOND; --xt.sec; } - milliseconds = ((xt.sec - cur.sec) * MILLISECONDS_PER_SECOND) + + milliseconds = (int)((xt.sec - cur.sec) * MILLISECONDS_PER_SECOND) + (((xt.nsec - cur.nsec) + (NANOSECONDS_PER_MILLISECOND/2)) / NANOSECONDS_PER_MILLISECOND); } @@ -117,7 +117,7 @@ inline void to_microduration(const boost::xtime& xt, int& microseconds) microseconds = 0; else { - microseconds = ((xt.sec - cur.sec) * MICROSECONDS_PER_SECOND) + + microseconds = (int)((xt.sec - cur.sec) * MICROSECONDS_PER_SECOND) + (((xt.nsec - cur.nsec) + (NANOSECONDS_PER_MICROSECOND/2)) / NANOSECONDS_PER_MICROSECOND); }