Ticket #3335: locks.hpp.patch

File locks.hpp.patch, 3.1 KB (added by Andrew Chittenden <andyc@…>, 13 years ago)

patch to boost/thread/locks.hpp to make it BOOST_NO_EXCEPTIONS aware.

  • boost/thread/locks.hpp

    old new  
    331331        }
    332332        void lock()
    333333        {
     334#ifndef BOOST_NO_EXCEPTIONS
    334335            if(owns_lock())
    335336            {
    336337                throw boost::lock_error();
    337338            }
     339#endif
    338340            m->lock();
    339341            is_locked=true;
    340342        }
    341343        bool try_lock()
    342344        {
     345#ifndef BOOST_NO_EXCEPTIONS
    343346            if(owns_lock())
    344347            {
    345348                throw boost::lock_error();
    346349            }
     350#endif
    347351            is_locked=m->try_lock();
    348352            return is_locked;
    349353        }
     
    366370        }
    367371        void unlock()
    368372        {
     373#ifndef BOOST_NO_EXCEPTIONS
    369374            if(!owns_lock())
    370375            {
    371376                throw boost::lock_error();
    372377            }
     378#endif
    373379            m->unlock();
    374380            is_locked=false;
    375381        }
     
    557563        }
    558564        void lock()
    559565        {
     566#ifndef BOOST_NO_EXCEPTIONS
    560567            if(owns_lock())
    561568            {
    562569                throw boost::lock_error();
    563570            }
     571#endif
    564572            m->lock_shared();
    565573            is_locked=true;
    566574        }
    567575        bool try_lock()
    568576        {
     577#ifndef BOOST_NO_EXCEPTIONS
    569578            if(owns_lock())
    570579            {
    571580                throw boost::lock_error();
    572581            }
     582#endif
    573583            is_locked=m->try_lock_shared();
    574584            return is_locked;
    575585        }
    576586        bool timed_lock(boost::system_time const& target_time)
    577587        {
     588#ifndef BOOST_NO_EXCEPTIONS
    578589            if(owns_lock())
    579590            {
    580591                throw boost::lock_error();
    581592            }
     593#endif
    582594            is_locked=m->timed_lock_shared(target_time);
    583595            return is_locked;
    584596        }
    585597        template<typename Duration>
    586598        bool timed_lock(Duration const& target_time)
    587599        {
     600#ifndef BOOST_NO_EXCEPTIONS
    588601            if(owns_lock())
    589602            {
    590603                throw boost::lock_error();
    591604            }
     605#endif
    592606            is_locked=m->timed_lock_shared(target_time);
    593607            return is_locked;
    594608        }
    595609        void unlock()
    596610        {
     611#ifndef BOOST_NO_EXCEPTIONS
    597612            if(!owns_lock())
    598613            {
    599614                throw boost::lock_error();
    600615            }
     616#endif
    601617            m->unlock_shared();
    602618            is_locked=false;
    603619        }
     
    720736        }
    721737        void lock()
    722738        {
     739#ifndef BOOST_NO_EXCEPTIONS
    723740            if(owns_lock())
    724741            {
    725742                throw boost::lock_error();
    726743            }
     744#endif
    727745            m->lock_upgrade();
    728746            is_locked=true;
    729747        }
    730748        bool try_lock()
    731749        {
     750#ifndef BOOST_NO_EXCEPTIONS
    732751            if(owns_lock())
    733752            {
    734753                throw boost::lock_error();
    735754            }
     755#endif
    736756            is_locked=m->try_lock_upgrade();
    737757            return is_locked;
    738758        }
    739759        void unlock()
    740760        {
     761#ifndef BOOST_NO_EXCEPTIONS
    741762            if(!owns_lock())
    742763            {
    743764                throw boost::lock_error();
    744765            }
     766#endif
    745767            m->unlock_upgrade();
    746768            is_locked=false;
    747769        }