Ticket #2100: boost_thread_no_exceptions.diff

File boost_thread_no_exceptions.diff, 11.3 KB (added by anonymous, 14 years ago)
  • boost/thread/locks.hpp

    diff -r 510d5bd079ad boost/thread/locks.hpp
    a b  
    137137        {
    138138            if(owns_lock())
    139139            {
    140                 throw boost::lock_error();
     140                boost::throw_exception(boost::lock_error());
    141141            }
    142142            m->lock();
    143143            is_locked=true;
     
    146146        {
    147147            if(owns_lock())
    148148            {
    149                 throw boost::lock_error();
     149                boost::throw_exception(boost::lock_error());
    150150            }
    151151            is_locked=m->try_lock();
    152152            return is_locked;
     
    167167        {
    168168            if(!owns_lock())
    169169            {
    170                 throw boost::lock_error();
     170                boost::throw_exception(boost::lock_error());
    171171            }
    172172            m->unlock();
    173173            is_locked=false;
     
    323323        {
    324324            if(owns_lock())
    325325            {
    326                 throw boost::lock_error();
     326                boost::throw_exception(boost::lock_error());
    327327            }
    328328            m->lock_shared();
    329329            is_locked=true;
     
    332332        {
    333333            if(owns_lock())
    334334            {
    335                 throw boost::lock_error();
     335                boost::throw_exception(boost::lock_error());
    336336            }
    337337            is_locked=m->try_lock_shared();
    338338            return is_locked;
     
    341341        {
    342342            if(owns_lock())
    343343            {
    344                 throw boost::lock_error();
     344                boost::throw_exception(boost::lock_error());
    345345            }
    346346            is_locked=m->timed_lock_shared(target_time);
    347347            return is_locked;
     
    350350        {
    351351            if(!owns_lock())
    352352            {
    353                 throw boost::lock_error();
     353                boost::throw_exception(boost::lock_error());
    354354            }
    355355            m->unlock_shared();
    356356            is_locked=false;
     
    466466        {
    467467            if(owns_lock())
    468468            {
    469                 throw boost::lock_error();
     469                boost::throw_exception(boost::lock_error());
    470470            }
    471471            m->lock_upgrade();
    472472            is_locked=true;
     
    475475        {
    476476            if(owns_lock())
    477477            {
    478                 throw boost::lock_error();
     478                boost::throw_exception(boost::lock_error());
    479479            }
    480480            is_locked=m->try_lock_upgrade();
    481481            return is_locked;
     
    484484        {
    485485            if(!owns_lock())
    486486            {
    487                 throw boost::lock_error();
     487                boost::throw_exception(boost::lock_error());
    488488            }
    489489            m->unlock_upgrade();
    490490            is_locked=false;
  • boost/thread/pthread/condition_variable.hpp

    diff -r 510d5bd079ad boost/thread/pthread/condition_variable.hpp
    a b  
    77
    88#include <limits.h>
    99#include <boost/assert.hpp>
     10#include <boost/throw_exception.hpp>
    1011#include <algorithm>
    1112#include <pthread.h>
    1213#include "timespec.hpp"
     
    2122        int const res=pthread_cond_init(&cond,NULL);
    2223        if(res)
    2324        {
    24             throw thread_resource_error();
     25            boost::throw_exception(thread_resource_error());
    2526        }
    2627    }
    2728    inline condition_variable::~condition_variable()
     
    7273            int const res=pthread_mutex_init(&internal_mutex,NULL);
    7374            if(res)
    7475            {
    75                 throw thread_resource_error();
     76                boost::throw_exception(thread_resource_error());
    7677            }
    7778            int const res2=pthread_cond_init(&cond,NULL);
    7879            if(res2)
    7980            {
    8081                BOOST_VERIFY(!pthread_mutex_destroy(&internal_mutex));
    81                 throw thread_resource_error();
     82                boost::throw_exception(thread_resource_error());
    8283            }
    8384        }
    8485        ~condition_variable_any()
     
    102103            }
    103104            if(res)
    104105            {
    105                 throw condition_error();
     106                boost::throw_exception(condition_error());
    106107            }
    107108        }
    108109
     
    132133            }
    133134            if(res)
    134135            {
    135                 throw condition_error();
     136                boost::throw_exception(condition_error());
    136137            }
    137138            return true;
    138139        }
  • boost/thread/pthread/mutex.hpp

    diff -r 510d5bd079ad boost/thread/pthread/mutex.hpp
    a b  
    77
    88#include <pthread.h>
    99#include <boost/utility.hpp>
     10#include <boost/throw_exception.hpp>
    1011#include <boost/thread/exceptions.hpp>
    1112#include <boost/thread/locks.hpp>
    1213#include <boost/thread/thread_time.hpp>
     
    3738            int const res=pthread_mutex_init(&m,NULL);
    3839            if(res)
    3940            {
    40                 throw thread_resource_error();
     41                boost::throw_exception(thread_resource_error());
    4142            }
    4243        }
    4344        ~mutex()
     
    8990            int const res=pthread_mutex_init(&m,NULL);
    9091            if(res)
    9192            {
    92                 throw thread_resource_error();
     93                boost::throw_exception(thread_resource_error());
    9394            }
    9495#ifndef BOOST_PTHREAD_HAS_TIMEDLOCK
    9596            int const res2=pthread_cond_init(&cond,NULL);
    9697            if(res2)
    9798            {
    9899                BOOST_VERIFY(!pthread_mutex_destroy(&m));
    99                 throw thread_resource_error();
     100                boost::throw_exception(thread_resource_error());
    100101            }
    101102            is_locked=false;
    102103#endif
  • boost/thread/pthread/once.hpp

    diff -r 510d5bd079ad boost/thread/pthread/once.hpp
    a b  
    1010//  http://www.boost.org/LICENSE_1_0.txt)
    1111
    1212#include <boost/thread/detail/config.hpp>
     13#include <boost/config.hpp>
    1314
    1415#include <pthread.h>
    1516#include <boost/assert.hpp>
     
    5556                if(flag.epoch==uninitialized_flag)
    5657                {
    5758                    flag.epoch=being_initialized;
     59#ifndef BOOST_NO_EXCEPTIONS
    5860                    try
    5961                    {
     62#endif
    6063                        pthread::pthread_mutex_scoped_unlock relocker(&detail::once_epoch_mutex);
    6164                        f();
     65#ifndef BOOST_NO_EXCEPTIONS
    6266                    }
    6367                    catch(...)
    6468                    {
     
    6670                        BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv));
    6771                        throw;
    6872                    }
     73#endif
    6974                    flag.epoch=--detail::once_global_epoch;
    7075                    BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv));
    7176                }
  • boost/thread/pthread/recursive_mutex.hpp

    diff -r 510d5bd079ad boost/thread/pthread/recursive_mutex.hpp
    a b  
    77
    88#include <pthread.h>
    99#include <boost/utility.hpp>
     10#include <boost/throw_exception.hpp>
    1011#include <boost/thread/exceptions.hpp>
    1112#include <boost/thread/locks.hpp>
    1213#include <boost/thread/thread_time.hpp>
     
    4041            int const init_attr_res=pthread_mutexattr_init(&attr);
    4142            if(init_attr_res)
    4243            {
    43                 throw thread_resource_error();
     44                boost::throw_exception(thread_resource_error());
    4445            }
    4546            int const set_attr_res=pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE);
    4647            if(set_attr_res)
    4748            {
    48                 throw thread_resource_error();
     49                boost::throw_exception(thread_resource_error());
    4950            }
    5051           
    5152            int const res=pthread_mutex_init(&m,&attr);
    5253            if(res)
    5354            {
    54                 throw thread_resource_error();
     55                boost::throw_exception(thread_resource_error());
    5556            }
    5657            BOOST_VERIFY(!pthread_mutexattr_destroy(&attr));
    5758        }
     
    102103            int const init_attr_res=pthread_mutexattr_init(&attr);
    103104            if(init_attr_res)
    104105            {
    105                 throw thread_resource_error();
     106                boost::throw_exception(thread_resource_error());
    106107            }
    107108            int const set_attr_res=pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE);
    108109            if(set_attr_res)
    109110            {
    110                 throw thread_resource_error();
     111                boost::throw_exception(thread_resource_error());
    111112            }
    112113           
    113114            int const res=pthread_mutex_init(&m,&attr);
    114115            if(res)
    115116            {
    116117                BOOST_VERIFY(!pthread_mutexattr_destroy(&attr));
    117                 throw thread_resource_error();
     118                boost::throw_exception(thread_resource_error());
    118119            }
    119120            BOOST_VERIFY(!pthread_mutexattr_destroy(&attr));
    120121#else
    121122            int const res=pthread_mutex_init(&m,NULL);
    122123            if(res)
    123124            {
    124                 throw thread_resource_error();
     125                boost::throw_exception(thread_resource_error());
    125126            }
    126127            int const res2=pthread_cond_init(&cond,NULL);
    127128            if(res2)
    128129            {
    129130                BOOST_VERIFY(!pthread_mutex_destroy(&m));
    130                 throw thread_resource_error();
     131                boost::throw_exception(thread_resource_error());
    131132            }
    132133            is_locked=false;
    133134            count=0;
  • boost/thread/pthread/thread_data.hpp

    diff -r 510d5bd079ad boost/thread/pthread/thread_data.hpp
    a b  
    1010#include <boost/enable_shared_from_this.hpp>
    1111#include <boost/thread/mutex.hpp>
    1212#include <boost/optional.hpp>
     13#include <boost/throw_exception.hpp>
    1314#include <pthread.h>
    1415#include "condition_variable_fwd.hpp"
    1516
    1617namespace boost
    1718{
    18     class thread_interrupted
     19    class thread_interrupted : public std::exception
    1920    {};
    2021
    2122    namespace detail
     
    6869                if(thread_info->interrupt_requested)
    6970                {
    7071                    thread_info->interrupt_requested=false;
    71                     throw thread_interrupted();
     72                    boost::throw_exception(thread_interrupted());
    7273                }
    7374            }
    7475           
  • libs/thread/src/pthread/thread.cpp

    diff -r 510d5bd079ad libs/thread/src/pthread/thread.cpp
    a b  
    1313#include <boost/thread/locks.hpp>
    1414#include <boost/thread/once.hpp>
    1515#include <boost/thread/tss.hpp>
     16#include <boost/throw_exception.hpp>
    1617#ifdef __linux__
    1718#include <sys/sysinfo.h>
    1819#elif defined(__APPLE__) || defined(__FreeBSD__)
     
    187188        if (res != 0)
    188189        {
    189190            thread_info->self.reset();
    190             throw thread_resource_error();
     191            boost::throw_exception(thread_resource_error());
    191192        }
    192193    }
    193194
     
    491492                if(thread_info->interrupt_requested)
    492493                {
    493494                    thread_info->interrupt_requested=false;
    494                     throw thread_interrupted();
     495                    boost::throw_exception(thread_interrupted());
    495496                }
    496497            }
    497498        }