Boost logo

Boost-Commit :

From: anthony_at_[hidden]
Date: 2007-11-02 10:58:49


Author: anthonyw
Date: 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
New Revision: 40685
URL: http://svn.boost.org/trac/boost/changeset/40685

Log:
renamed cancellation to interruption
Text files modified:
   trunk/boost/thread/pthread/condition_variable.hpp | 8 ++--
   trunk/boost/thread/pthread/condition_variable_fwd.hpp | 2
   trunk/boost/thread/pthread/shared_mutex.hpp | 14 +++---
   trunk/boost/thread/pthread/thread.hpp | 34 ++++++++--------
   trunk/boost/thread/pthread/thread_data.hpp | 32 ++++++++--------
   trunk/boost/thread/win32/condition_variable.hpp | 2
   trunk/boost/thread/win32/thread.hpp | 80 ++++++++++++++++++++--------------------
   trunk/libs/thread/src/pthread/thread.cpp | 60 ++++++++++++++++++-----------
   trunk/libs/thread/src/win32/thread.cpp | 78 +++++++++++++++++++-------------------
   trunk/libs/thread/test/test_condition.cpp | 10 ++--
   trunk/libs/thread/test/test_thread.cpp | 34 ++++++++--------
   11 files changed, 184 insertions(+), 170 deletions(-)

Modified: trunk/boost/thread/pthread/condition_variable.hpp
==============================================================================
--- trunk/boost/thread/pthread/condition_variable.hpp (original)
+++ trunk/boost/thread/pthread/condition_variable.hpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -34,14 +34,14 @@
 
     inline void condition_variable::wait(unique_lock<mutex>& m)
     {
- detail::cancel_wrapper allow_cancel(&cond);
+ detail::interruption_checker check_for_interruption(&cond);
         int const cond_res=pthread_cond_wait(&cond,m.mutex()->native_handle());
         BOOST_ASSERT(!cond_res);
     }
 
     inline bool condition_variable::timed_wait(unique_lock<mutex>& m,boost::system_time const& wait_until)
     {
- detail::cancel_wrapper allow_cancel(&cond);
+ detail::interruption_checker check_for_interruption(&cond);
         struct timespec const timeout=detail::get_timespec(wait_until);
         int const cond_res=pthread_cond_timedwait(&cond,m.mutex()->native_handle(),&timeout);
         if(cond_res==ETIMEDOUT)
@@ -101,7 +101,7 @@
         {
             int res=0;
             {
- detail::cancel_wrapper allow_cancel(&cond);
+ detail::interruption_checker check_for_interruption(&cond);
                 {
                     boost::pthread::pthread_mutex_scoped_lock internal_lock(&internal_mutex);
                     m.unlock();
@@ -127,7 +127,7 @@
             struct timespec const timeout=detail::get_timespec(wait_until);
             int res=0;
             {
- detail::cancel_wrapper allow_cancel(&cond);
+ detail::interruption_checker check_for_interruption(&cond);
                 {
                     boost::pthread::pthread_mutex_scoped_lock internal_lock(&internal_mutex);
                     m.unlock();

Modified: trunk/boost/thread/pthread/condition_variable_fwd.hpp
==============================================================================
--- trunk/boost/thread/pthread/condition_variable_fwd.hpp (original)
+++ trunk/boost/thread/pthread/condition_variable_fwd.hpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -19,7 +19,7 @@
         condition_variable(condition_variable&);
         condition_variable& operator=(condition_variable&);
 
- struct cancel_wrapper;
+ struct interruption_checker;
     public:
         condition_variable();
         ~condition_variable();

Modified: trunk/boost/thread/pthread/shared_mutex.hpp
==============================================================================
--- trunk/boost/thread/pthread/shared_mutex.hpp (original)
+++ trunk/boost/thread/pthread/shared_mutex.hpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -53,7 +53,7 @@
 
         void lock_shared()
         {
- boost::this_thread::disable_cancellation no_cancel;
+ boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
                 
             while(true)
@@ -85,7 +85,7 @@
 
         bool timed_lock_shared(system_time const& timeout)
         {
- boost::this_thread::disable_cancellation no_cancel;
+ boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
                 
             while(true)
@@ -126,7 +126,7 @@
 
         void lock()
         {
- boost::this_thread::disable_cancellation no_cancel;
+ boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
                 
             while(true)
@@ -146,7 +146,7 @@
 
         bool timed_lock(system_time const& timeout)
         {
- boost::this_thread::disable_cancellation no_cancel;
+ boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
                 
             while(true)
@@ -193,7 +193,7 @@
 
         void lock_upgrade()
         {
- boost::this_thread::disable_cancellation no_cancel;
+ boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
             while(true)
             {
@@ -210,7 +210,7 @@
 
         bool timed_lock_upgrade(system_time const& timeout)
         {
- boost::this_thread::disable_cancellation no_cancel;
+ boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
             while(true)
             {
@@ -258,7 +258,7 @@
 
         void unlock_upgrade_and_lock()
         {
- boost::this_thread::disable_cancellation no_cancel;
+ boost::this_thread::disable_interruption do_not_disturb;
             boost::mutex::scoped_lock lock(state_change);
             --state.shared_count;
             while(true)

Modified: trunk/boost/thread/pthread/thread.hpp
==============================================================================
--- trunk/boost/thread/pthread/thread.hpp (original)
+++ trunk/boost/thread/pthread/thread.hpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -165,8 +165,8 @@
         static void yield();
 
         // extensions
- void cancel();
- bool cancellation_requested() const;
+ void interrupt();
+ bool interruption_requested() const;
     };
 
     template<typename F>
@@ -187,25 +187,25 @@
 
     namespace this_thread
     {
- class BOOST_THREAD_DECL disable_cancellation
+ class BOOST_THREAD_DECL disable_interruption
         {
- disable_cancellation(const disable_cancellation&);
- disable_cancellation& operator=(const disable_cancellation&);
+ disable_interruption(const disable_interruption&);
+ disable_interruption& operator=(const disable_interruption&);
             
- bool cancel_was_enabled;
- friend class restore_cancellation;
+ bool interruption_was_enabled;
+ friend class restore_interruption;
         public:
- disable_cancellation();
- ~disable_cancellation();
+ disable_interruption();
+ ~disable_interruption();
         };
 
- class BOOST_THREAD_DECL restore_cancellation
+ class BOOST_THREAD_DECL restore_interruption
         {
- restore_cancellation(const restore_cancellation&);
- restore_cancellation& operator=(const restore_cancellation&);
+ restore_interruption(const restore_interruption&);
+ restore_interruption& operator=(const restore_interruption&);
         public:
- explicit restore_cancellation(disable_cancellation& d);
- ~restore_cancellation();
+ explicit restore_interruption(disable_interruption& d);
+ ~restore_interruption();
         };
 
         inline thread::id get_id()
@@ -213,9 +213,9 @@
             return thread::id(pthread_self());
         }
 
- void BOOST_THREAD_DECL cancellation_point();
- bool BOOST_THREAD_DECL cancellation_enabled();
- bool BOOST_THREAD_DECL cancellation_requested();
+ void BOOST_THREAD_DECL interruption_point();
+ bool BOOST_THREAD_DECL interruption_enabled();
+ bool BOOST_THREAD_DECL interruption_requested();
 
         inline void yield()
         {

Modified: trunk/boost/thread/pthread/thread_data.hpp
==============================================================================
--- trunk/boost/thread/pthread/thread_data.hpp (original)
+++ trunk/boost/thread/pthread/thread_data.hpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -14,7 +14,7 @@
 
 namespace boost
 {
- class thread_cancelled
+ class thread_interrupted
     {};
 
     namespace detail
@@ -33,15 +33,15 @@
             bool join_started;
             bool joined;
             boost::detail::thread_exit_callback_node* thread_exit_callbacks;
- bool cancel_enabled;
- bool cancel_requested;
+ bool interrupt_enabled;
+ bool interrupt_requested;
             pthread_cond_t* current_cond;
 
             thread_data_base():
                 done(false),join_started(false),joined(false),
                 thread_exit_callbacks(0),
- cancel_enabled(true),
- cancel_requested(false),
+ interrupt_enabled(true),
+ interrupt_requested(false),
                 current_cond(0)
             {}
             virtual ~thread_data_base()
@@ -52,37 +52,37 @@
 
         BOOST_THREAD_DECL thread_data_base* get_current_thread_data();
 
- class cancel_wrapper
+ class interrupt_wrapper
         {
             thread_data_base* const thread_info;
 
- void check_cancel()
+ void check_for_interruption()
             {
- if(thread_info->cancel_requested)
+ if(thread_info->interrupt_requested)
                 {
- thread_info->cancel_requested=false;
- throw thread_cancelled();
+ thread_info->interrupt_requested=false;
+ throw thread_interrupted();
                 }
             }
             
         public:
- explicit cancel_wrapper(pthread_cond_t* cond):
+ explicit interrupt_wrapper(pthread_cond_t* cond):
                 thread_info(detail::get_current_thread_data())
             {
- if(thread_info && thread_info->cancel_enabled)
+ if(thread_info && thread_info->interrupt_enabled)
                 {
                     lock_guard<mutex> guard(thread_info->data_mutex);
- check_cancel();
+ check_for_interruption();
                     thread_info->current_cond=cond;
                 }
             }
- ~cancel_wrapper()
+ ~interrupt_wrapper()
             {
- if(thread_info && thread_info->cancel_enabled)
+ if(thread_info && thread_info->interrupt_enabled)
                 {
                     lock_guard<mutex> guard(thread_info->data_mutex);
                     thread_info->current_cond=NULL;
- check_cancel();
+ check_for_interruption();
                 }
             }
         };

Modified: trunk/boost/thread/win32/condition_variable.hpp
==============================================================================
--- trunk/boost/thread/win32/condition_variable.hpp (original)
+++ trunk/boost/thread/win32/condition_variable.hpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -156,7 +156,7 @@
                         ++generations[0].count;
                         sem=detail::win32::duplicate_handle(generations[0].semaphore);
                     }
- if(!this_thread::cancellable_wait(sem,::boost::detail::get_milliseconds_until(wait_until)))
+ if(!this_thread::interruptible_wait(sem,::boost::detail::get_milliseconds_until(wait_until)))
                     {
                         break;
                     }

Modified: trunk/boost/thread/win32/thread.hpp
==============================================================================
--- trunk/boost/thread/win32/thread.hpp (original)
+++ trunk/boost/thread/win32/thread.hpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -21,7 +21,7 @@
 
 namespace boost
 {
- class thread_cancelled
+ class thread_interrupted
     {};
 
     namespace detail
@@ -32,16 +32,16 @@
         {
             long count;
             detail::win32::handle_manager thread_handle;
- detail::win32::handle_manager cancel_handle;
+ detail::win32::handle_manager interruption_handle;
             boost::detail::thread_exit_callback_node* thread_exit_callbacks;
- bool cancel_enabled;
+ bool interruption_enabled;
             unsigned id;
 
             thread_data_base():
                 count(0),thread_handle(detail::win32::invalid_handle_value),
- cancel_handle(create_anonymous_event(detail::win32::manual_reset_event,detail::win32::event_initially_reset)),
+ interruption_handle(create_anonymous_event(detail::win32::manual_reset_event,detail::win32::event_initially_reset)),
                 thread_exit_callbacks(0),
- cancel_enabled(true),
+ interruption_enabled(true),
                 id(0)
             {}
             virtual ~thread_data_base()
@@ -153,10 +153,10 @@
         static void sleep(const system_time& xt);
 
         // extensions
- class cancel_handle;
- cancel_handle get_cancel_handle() const;
- void cancel();
- bool cancellation_requested() const;
+ class interruption_handle;
+ interruption_handle get_interruption_handle() const;
+ void interrupt();
+ bool interruption_requested() const;
 
         static thread self();
     };
@@ -180,45 +180,45 @@
 
     namespace this_thread
     {
- class BOOST_THREAD_DECL disable_cancellation
+ class BOOST_THREAD_DECL disable_interruption
         {
- disable_cancellation(const disable_cancellation&);
- disable_cancellation& operator=(const disable_cancellation&);
+ disable_interruption(const disable_interruption&);
+ disable_interruption& operator=(const disable_interruption&);
             
- bool cancel_was_enabled;
- friend class restore_cancellation;
+ bool interruption_was_enabled;
+ friend class restore_interruption;
         public:
- disable_cancellation();
- ~disable_cancellation();
+ disable_interruption();
+ ~disable_interruption();
         };
 
- class BOOST_THREAD_DECL restore_cancellation
+ class BOOST_THREAD_DECL restore_interruption
         {
- restore_cancellation(const restore_cancellation&);
- restore_cancellation& operator=(const restore_cancellation&);
+ restore_interruption(const restore_interruption&);
+ restore_interruption& operator=(const restore_interruption&);
         public:
- explicit restore_cancellation(disable_cancellation& d);
- ~restore_cancellation();
+ explicit restore_interruption(disable_interruption& d);
+ ~restore_interruption();
         };
 
         thread::id BOOST_THREAD_DECL get_id();
 
- bool BOOST_THREAD_DECL cancellable_wait(detail::win32::handle handle_to_wait_for,unsigned long milliseconds);
- inline bool cancellable_wait(unsigned long milliseconds)
+ bool BOOST_THREAD_DECL interruptible_wait(detail::win32::handle handle_to_wait_for,unsigned long milliseconds);
+ inline bool interruptible_wait(unsigned long milliseconds)
         {
- return cancellable_wait(detail::win32::invalid_handle_value,milliseconds);
+ return interruptible_wait(detail::win32::invalid_handle_value,milliseconds);
         }
 
- void BOOST_THREAD_DECL cancellation_point();
- bool BOOST_THREAD_DECL cancellation_enabled();
- bool BOOST_THREAD_DECL cancellation_requested();
- thread::cancel_handle BOOST_THREAD_DECL get_cancel_handle();
+ void BOOST_THREAD_DECL interruption_point();
+ bool BOOST_THREAD_DECL interruption_enabled();
+ bool BOOST_THREAD_DECL interruption_requested();
+ thread::interruption_handle BOOST_THREAD_DECL get_interruption_handle();
 
         void BOOST_THREAD_DECL yield();
         template<typename TimeDuration>
         void sleep(TimeDuration const& rel_time)
         {
- cancellable_wait(static_cast<unsigned long>(rel_time.total_milliseconds()));
+ interruptible_wait(static_cast<unsigned long>(rel_time.total_milliseconds()));
         }
     }
 
@@ -285,32 +285,32 @@
         return get_id()!=other.get_id();
     }
 
- class thread::cancel_handle
+ class thread::interruption_handle
     {
     private:
         boost::detail::win32::handle_manager handle;
         friend class thread;
- friend cancel_handle this_thread::get_cancel_handle();
+ friend interruption_handle this_thread::get_interruption_handle();
 
- cancel_handle(detail::win32::handle h_):
+ interruption_handle(detail::win32::handle h_):
             handle(h_)
         {}
     public:
- cancel_handle(cancel_handle const& other):
+ interruption_handle(interruption_handle const& other):
             handle(other.handle.duplicate())
         {}
- cancel_handle():
+ interruption_handle():
             handle(0)
         {}
 
- void swap(cancel_handle& other)
+ void swap(interruption_handle& other)
         {
             handle.swap(other.handle);
         }
         
- cancel_handle& operator=(cancel_handle const& other)
+ interruption_handle& operator=(interruption_handle const& other)
         {
- cancel_handle temp(other);
+ interruption_handle temp(other);
             swap(temp);
             return *this;
         }
@@ -320,7 +320,7 @@
             handle=0;
         }
 
- void cancel()
+ void interrupt()
         {
             if(handle)
             {
@@ -328,10 +328,10 @@
             }
         }
 
- typedef void(cancel_handle::*bool_type)();
+ typedef void(interruption_handle::*bool_type)();
         operator bool_type() const
         {
- return handle?&cancel_handle::cancel:0;
+ return handle?&interruption_handle::interrupt:0;
         }
     };
         

Modified: trunk/libs/thread/src/pthread/thread.cpp
==============================================================================
--- trunk/libs/thread/src/pthread/thread.cpp (original)
+++ trunk/libs/thread/src/pthread/thread.cpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -87,7 +87,7 @@
                 {
                     thread_info->run();
                 }
- catch(thread_cancelled const&)
+ catch(thread_interrupted const&)
                 {
                 }
                 catch(...)
@@ -340,13 +340,13 @@
         }
     }
 
- void thread::cancel()
+ void thread::interrupt()
     {
         boost::shared_ptr<detail::thread_data_base> local_thread_info=get_thread_info();
         if(local_thread_info)
         {
             lock_guard<mutex> lk(local_thread_info->data_mutex);
- local_thread_info->cancel_requested=true;
+ local_thread_info->interrupt_requested=true;
             if(local_thread_info->current_cond)
             {
                 int const res=pthread_cond_broadcast(local_thread_info->current_cond);
@@ -354,31 +354,45 @@
             }
         }
     }
+
+ bool thread::interruption_requested() const
+ {
+ boost::shared_ptr<detail::thread_data_base> local_thread_info=get_thread_info();
+ if(local_thread_info)
+ {
+ lock_guard<mutex> lk(local_thread_info->data_mutex);
+ return local_thread_info->interrupt_requested;
+ }
+ else
+ {
+ return false;
+ }
+ }
     
 
     namespace this_thread
     {
- void cancellation_point()
+ void interruption_point()
         {
             boost::detail::thread_data_base* const thread_info=detail::get_current_thread_data();
- if(thread_info && thread_info->cancel_enabled)
+ if(thread_info && thread_info->interrupt_enabled)
             {
                 lock_guard<mutex> lg(thread_info->data_mutex);
- if(thread_info->cancel_requested)
+ if(thread_info->interrupt_requested)
                 {
- thread_info->cancel_requested=false;
- throw thread_cancelled();
+ thread_info->interrupt_requested=false;
+ throw thread_interrupted();
                 }
             }
         }
         
- bool cancellation_enabled()
+ bool interruption_enabled()
         {
             boost::detail::thread_data_base* const thread_info=detail::get_current_thread_data();
- return thread_info && thread_info->cancel_enabled;
+ return thread_info && thread_info->interrupt_enabled;
         }
         
- bool cancellation_requested()
+ bool interruption_requested()
         {
             boost::detail::thread_data_base* const thread_info=detail::get_current_thread_data();
             if(!thread_info)
@@ -388,40 +402,40 @@
             else
             {
                 lock_guard<mutex> lg(thread_info->data_mutex);
- return thread_info->cancel_requested;
+ return thread_info->interrupt_requested;
             }
         }
 
- disable_cancellation::disable_cancellation():
- cancel_was_enabled(cancellation_enabled())
+ disable_interruption::disable_interruption():
+ interruption_was_enabled(interruption_enabled())
         {
- if(cancel_was_enabled)
+ if(interruption_was_enabled)
             {
- detail::get_current_thread_data()->cancel_enabled=false;
+ detail::get_current_thread_data()->interrupt_enabled=false;
             }
         }
         
- disable_cancellation::~disable_cancellation()
+ disable_interruption::~disable_interruption()
         {
             if(detail::get_current_thread_data())
             {
- detail::get_current_thread_data()->cancel_enabled=cancel_was_enabled;
+ detail::get_current_thread_data()->interrupt_enabled=interruption_was_enabled;
             }
         }
 
- restore_cancellation::restore_cancellation(disable_cancellation& d)
+ restore_interruption::restore_interruption(disable_interruption& d)
         {
- if(d.cancel_was_enabled)
+ if(d.interruption_was_enabled)
             {
- detail::get_current_thread_data()->cancel_enabled=true;
+ detail::get_current_thread_data()->interrupt_enabled=true;
             }
         }
         
- restore_cancellation::~restore_cancellation()
+ restore_interruption::~restore_interruption()
         {
             if(detail::get_current_thread_data())
             {
- detail::get_current_thread_data()->cancel_enabled=false;
+ detail::get_current_thread_data()->interrupt_enabled=false;
             }
         }
     }

Modified: trunk/libs/thread/src/win32/thread.cpp
==============================================================================
--- trunk/libs/thread/src/win32/thread.cpp (original)
+++ trunk/libs/thread/src/win32/thread.cpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -166,7 +166,7 @@
         {
             thread_info->run();
         }
- catch(thread_cancelled const&)
+ catch(thread_interrupted const&)
         {
         }
         catch(...)
@@ -204,7 +204,7 @@
             externally_launched_thread()
             {
                 ++count;
- cancel_enabled=false;
+ interruption_enabled=false;
                 thread_handle=detail::win32::duplicate_handle(detail::win32::GetCurrentThread());
             }
             
@@ -266,10 +266,10 @@
         return local_thread_info?thread::id(local_thread_info->id):thread::id();
     }
 
- thread::cancel_handle thread::get_cancel_handle() const
+ thread::interruption_handle thread::get_interruption_handle() const
     {
         boost::intrusive_ptr<detail::thread_data_base> local_thread_info=get_thread_info();
- return local_thread_info?thread::cancel_handle(local_thread_info->cancel_handle.duplicate()):thread::cancel_handle();
+ return local_thread_info?thread::interruption_handle(local_thread_info->interruption_handle.duplicate()):thread::interruption_handle();
     }
     
     bool thread::joinable() const
@@ -282,7 +282,7 @@
         boost::intrusive_ptr<detail::thread_data_base> local_thread_info=get_thread_info();
         if(local_thread_info)
         {
- this_thread::cancellable_wait(local_thread_info->thread_handle,detail::win32::infinite);
+ this_thread::interruptible_wait(local_thread_info->thread_handle,detail::win32::infinite);
             release_handle();
         }
     }
@@ -292,7 +292,7 @@
         boost::intrusive_ptr<detail::thread_data_base> local_thread_info=get_thread_info();
         if(local_thread_info)
         {
- if(!this_thread::cancellable_wait(local_thread_info->thread_handle,get_milliseconds_until(wait_until)))
+ if(!this_thread::interruptible_wait(local_thread_info->thread_handle,get_milliseconds_until(wait_until)))
             {
                 return false;
             }
@@ -312,19 +312,19 @@
         thread_info=0;
     }
     
- void thread::cancel()
+ void thread::interrupt()
     {
         boost::intrusive_ptr<detail::thread_data_base> local_thread_info=get_thread_info();
         if(local_thread_info)
         {
- detail::win32::SetEvent(local_thread_info->cancel_handle);
+ detail::win32::SetEvent(local_thread_info->interruption_handle);
         }
     }
     
- bool thread::cancellation_requested() const
+ bool thread::interruption_requested() const
     {
         boost::intrusive_ptr<detail::thread_data_base> local_thread_info=get_thread_info();
- return local_thread_info.get() && (detail::win32::WaitForSingleObject(local_thread_info->cancel_handle,0)==0);
+ return local_thread_info.get() && (detail::win32::WaitForSingleObject(local_thread_info->interruption_handle,0)==0);
     }
     
     unsigned thread::hardware_concurrency()
@@ -348,24 +348,24 @@
 
     namespace this_thread
     {
- thread::cancel_handle get_cancel_handle()
+ thread::interruption_handle get_interruption_handle()
         {
- return get_current_thread_data()?thread::cancel_handle(get_current_thread_data()->cancel_handle.duplicate()):thread::cancel_handle();
+ return get_current_thread_data()?thread::interruption_handle(get_current_thread_data()->interruption_handle.duplicate()):thread::interruption_handle();
         }
 
- bool cancellable_wait(detail::win32::handle handle_to_wait_for,unsigned long milliseconds)
+ bool interruptible_wait(detail::win32::handle handle_to_wait_for,unsigned long milliseconds)
         {
             detail::win32::handle handles[2]={0};
             unsigned handle_count=0;
- unsigned cancel_index=~0U;
+ unsigned interruption_index=~0U;
             if(handle_to_wait_for!=detail::win32::invalid_handle_value)
             {
                 handles[handle_count++]=handle_to_wait_for;
             }
- if(get_current_thread_data() && get_current_thread_data()->cancel_enabled)
+ if(get_current_thread_data() && get_current_thread_data()->interruption_enabled)
             {
- cancel_index=handle_count;
- handles[handle_count++]=get_current_thread_data()->cancel_handle;
+ interruption_index=handle_count;
+ handles[handle_count++]=get_current_thread_data()->interruption_handle;
             }
         
             if(handle_count)
@@ -375,10 +375,10 @@
                 {
                     return true;
                 }
- else if(notified_index==cancel_index)
+ else if(notified_index==interruption_index)
                 {
- detail::win32::ResetEvent(get_current_thread_data()->cancel_handle);
- throw thread_cancelled();
+ detail::win32::ResetEvent(get_current_thread_data()->interruption_handle);
+ throw thread_interrupted();
                 }
             }
             else
@@ -393,23 +393,23 @@
             return thread::id(detail::win32::GetCurrentThreadId());
         }
 
- void cancellation_point()
+ void interruption_point()
         {
- if(cancellation_enabled() && cancellation_requested())
+ if(interruption_enabled() && interruption_requested())
             {
- detail::win32::ResetEvent(get_current_thread_data()->cancel_handle);
- throw thread_cancelled();
+ detail::win32::ResetEvent(get_current_thread_data()->interruption_handle);
+ throw thread_interrupted();
             }
         }
         
- bool cancellation_enabled()
+ bool interruption_enabled()
         {
- return get_current_thread_data() && get_current_thread_data()->cancel_enabled;
+ return get_current_thread_data() && get_current_thread_data()->interruption_enabled;
         }
         
- bool cancellation_requested()
+ bool interruption_requested()
         {
- return get_current_thread_data() && (detail::win32::WaitForSingleObject(get_current_thread_data()->cancel_handle,0)==0);
+ return get_current_thread_data() && (detail::win32::WaitForSingleObject(get_current_thread_data()->interruption_handle,0)==0);
         }
 
         void yield()
@@ -417,36 +417,36 @@
             detail::win32::Sleep(0);
         }
         
- disable_cancellation::disable_cancellation():
- cancel_was_enabled(cancellation_enabled())
+ disable_interruption::disable_interruption():
+ interruption_was_enabled(interruption_enabled())
         {
- if(cancel_was_enabled)
+ if(interruption_was_enabled)
             {
- get_current_thread_data()->cancel_enabled=false;
+ get_current_thread_data()->interruption_enabled=false;
             }
         }
         
- disable_cancellation::~disable_cancellation()
+ disable_interruption::~disable_interruption()
         {
             if(get_current_thread_data())
             {
- get_current_thread_data()->cancel_enabled=cancel_was_enabled;
+ get_current_thread_data()->interruption_enabled=interruption_was_enabled;
             }
         }
 
- restore_cancellation::restore_cancellation(disable_cancellation& d)
+ restore_interruption::restore_interruption(disable_interruption& d)
         {
- if(d.cancel_was_enabled)
+ if(d.interruption_was_enabled)
             {
- get_current_thread_data()->cancel_enabled=true;
+ get_current_thread_data()->interruption_enabled=true;
             }
         }
         
- restore_cancellation::~restore_cancellation()
+ restore_interruption::~restore_interruption()
         {
             if(get_current_thread_data())
             {
- get_current_thread_data()->cancel_enabled=false;
+ get_current_thread_data()->interruption_enabled=false;
             }
         }
     }

Modified: trunk/libs/thread/test/test_condition.cpp
==============================================================================
--- trunk/libs/thread/test/test_condition.cpp (original)
+++ trunk/libs/thread/test/test_condition.cpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -189,21 +189,21 @@
     timed_test(&do_test_condition_waits, 12);
 }
 
-void do_test_condition_wait_is_a_cancellation_point()
+void do_test_condition_wait_is_a_interruption_point()
 {
     condition_test_data data;
 
     boost::thread thread(bind(&condition_test_thread, &data));
 
- thread.cancel();
+ thread.interrupt();
     thread.join();
     BOOST_CHECK_EQUAL(data.awoken,0);
 }
 
 
-void test_condition_wait_is_a_cancellation_point()
+void test_condition_wait_is_a_interruption_point()
 {
- timed_test(&do_test_condition_wait_is_a_cancellation_point, 1);
+ timed_test(&do_test_condition_wait_is_a_interruption_point, 1);
 }
 
 
@@ -215,7 +215,7 @@
     test->add(BOOST_TEST_CASE(&test_condition_notify_one));
     test->add(BOOST_TEST_CASE(&test_condition_notify_all));
     test->add(BOOST_TEST_CASE(&test_condition_waits));
- test->add(BOOST_TEST_CASE(&test_condition_wait_is_a_cancellation_point));
+ test->add(BOOST_TEST_CASE(&test_condition_wait_is_a_interruption_point));
 
     return test;
 }

Modified: trunk/libs/thread/test/test_thread.cpp
==============================================================================
--- trunk/libs/thread/test/test_thread.cpp (original)
+++ trunk/libs/thread/test/test_thread.cpp 2007-11-02 10:58:48 EDT (Fri, 02 Nov 2007)
@@ -71,53 +71,53 @@
     timed_test(&do_test_id_comparison, 1);
 }
 
-void cancellation_point_thread(boost::mutex* m,bool* failed)
+void interruption_point_thread(boost::mutex* m,bool* failed)
 {
     boost::mutex::scoped_lock lk(*m);
- boost::this_thread::cancellation_point();
+ boost::this_thread::interruption_point();
     *failed=true;
 }
 
-void do_test_thread_cancels_at_cancellation_point()
+void do_test_thread_interrupts_at_interruption_point()
 {
     boost::mutex m;
     bool failed=false;
     boost::mutex::scoped_lock lk(m);
- boost::thread thrd(boost::bind(&cancellation_point_thread,&m,&failed));
- thrd.cancel();
+ boost::thread thrd(boost::bind(&interruption_point_thread,&m,&failed));
+ thrd.interrupt();
     lk.unlock();
     thrd.join();
     BOOST_CHECK(!failed);
 }
 
-void test_thread_cancels_at_cancellation_point()
+void test_thread_interrupts_at_interruption_point()
 {
- timed_test(&do_test_thread_cancels_at_cancellation_point, 1);
+ timed_test(&do_test_thread_interrupts_at_interruption_point, 1);
 }
 
-void disabled_cancellation_point_thread(boost::mutex* m,bool* failed)
+void disabled_interruption_point_thread(boost::mutex* m,bool* failed)
 {
     boost::mutex::scoped_lock lk(*m);
- boost::this_thread::disable_cancellation dc;
- boost::this_thread::cancellation_point();
+ boost::this_thread::disable_interruption dc;
+ boost::this_thread::interruption_point();
     *failed=false;
 }
 
-void do_test_thread_no_cancel_if_cancels_disabled_at_cancellation_point()
+void do_test_thread_no_interrupt_if_interrupts_disabled_at_interruption_point()
 {
     boost::mutex m;
     bool failed=true;
     boost::mutex::scoped_lock lk(m);
- boost::thread thrd(boost::bind(&disabled_cancellation_point_thread,&m,&failed));
- thrd.cancel();
+ boost::thread thrd(boost::bind(&disabled_interruption_point_thread,&m,&failed));
+ thrd.interrupt();
     lk.unlock();
     thrd.join();
     BOOST_CHECK(!failed);
 }
 
-void test_thread_no_cancel_if_cancels_disabled_at_cancellation_point()
+void test_thread_no_interrupt_if_interrupts_disabled_at_interruption_point()
 {
- timed_test(&do_test_thread_no_cancel_if_cancels_disabled_at_cancellation_point, 1);
+ timed_test(&do_test_thread_no_interrupt_if_interrupts_disabled_at_interruption_point, 1);
 }
 
 struct non_copyable_functor:
@@ -207,8 +207,8 @@
     test->add(BOOST_TEST_CASE(test_sleep));
     test->add(BOOST_TEST_CASE(test_creation));
     test->add(BOOST_TEST_CASE(test_id_comparison));
- test->add(BOOST_TEST_CASE(test_thread_cancels_at_cancellation_point));
- test->add(BOOST_TEST_CASE(test_thread_no_cancel_if_cancels_disabled_at_cancellation_point));
+ test->add(BOOST_TEST_CASE(test_thread_interrupts_at_interruption_point));
+ test->add(BOOST_TEST_CASE(test_thread_no_interrupt_if_interrupts_disabled_at_interruption_point));
     test->add(BOOST_TEST_CASE(test_creation_through_reference_wrapper));
     test->add(BOOST_TEST_CASE(test_timed_join));
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk