Ticket #3335: locks.hpp.patch
File locks.hpp.patch, 3.1 KB (added by , 13 years ago) |
---|
-
boost/thread/locks.hpp
old new 331 331 } 332 332 void lock() 333 333 { 334 #ifndef BOOST_NO_EXCEPTIONS 334 335 if(owns_lock()) 335 336 { 336 337 throw boost::lock_error(); 337 338 } 339 #endif 338 340 m->lock(); 339 341 is_locked=true; 340 342 } 341 343 bool try_lock() 342 344 { 345 #ifndef BOOST_NO_EXCEPTIONS 343 346 if(owns_lock()) 344 347 { 345 348 throw boost::lock_error(); 346 349 } 350 #endif 347 351 is_locked=m->try_lock(); 348 352 return is_locked; 349 353 } … … 366 370 } 367 371 void unlock() 368 372 { 373 #ifndef BOOST_NO_EXCEPTIONS 369 374 if(!owns_lock()) 370 375 { 371 376 throw boost::lock_error(); 372 377 } 378 #endif 373 379 m->unlock(); 374 380 is_locked=false; 375 381 } … … 557 563 } 558 564 void lock() 559 565 { 566 #ifndef BOOST_NO_EXCEPTIONS 560 567 if(owns_lock()) 561 568 { 562 569 throw boost::lock_error(); 563 570 } 571 #endif 564 572 m->lock_shared(); 565 573 is_locked=true; 566 574 } 567 575 bool try_lock() 568 576 { 577 #ifndef BOOST_NO_EXCEPTIONS 569 578 if(owns_lock()) 570 579 { 571 580 throw boost::lock_error(); 572 581 } 582 #endif 573 583 is_locked=m->try_lock_shared(); 574 584 return is_locked; 575 585 } 576 586 bool timed_lock(boost::system_time const& target_time) 577 587 { 588 #ifndef BOOST_NO_EXCEPTIONS 578 589 if(owns_lock()) 579 590 { 580 591 throw boost::lock_error(); 581 592 } 593 #endif 582 594 is_locked=m->timed_lock_shared(target_time); 583 595 return is_locked; 584 596 } 585 597 template<typename Duration> 586 598 bool timed_lock(Duration const& target_time) 587 599 { 600 #ifndef BOOST_NO_EXCEPTIONS 588 601 if(owns_lock()) 589 602 { 590 603 throw boost::lock_error(); 591 604 } 605 #endif 592 606 is_locked=m->timed_lock_shared(target_time); 593 607 return is_locked; 594 608 } 595 609 void unlock() 596 610 { 611 #ifndef BOOST_NO_EXCEPTIONS 597 612 if(!owns_lock()) 598 613 { 599 614 throw boost::lock_error(); 600 615 } 616 #endif 601 617 m->unlock_shared(); 602 618 is_locked=false; 603 619 } … … 720 736 } 721 737 void lock() 722 738 { 739 #ifndef BOOST_NO_EXCEPTIONS 723 740 if(owns_lock()) 724 741 { 725 742 throw boost::lock_error(); 726 743 } 744 #endif 727 745 m->lock_upgrade(); 728 746 is_locked=true; 729 747 } 730 748 bool try_lock() 731 749 { 750 #ifndef BOOST_NO_EXCEPTIONS 732 751 if(owns_lock()) 733 752 { 734 753 throw boost::lock_error(); 735 754 } 755 #endif 736 756 is_locked=m->try_lock_upgrade(); 737 757 return is_locked; 738 758 } 739 759 void unlock() 740 760 { 761 #ifndef BOOST_NO_EXCEPTIONS 741 762 if(!owns_lock()) 742 763 { 743 764 throw boost::lock_error(); 744 765 } 766 #endif 745 767 m->unlock_upgrade(); 746 768 is_locked=false; 747 769 }