Ticket #2501: 2501.patch
File 2501.patch, 2.5 KB (added by , 13 years ago) |
---|
-
boost/thread/locks.hpp
old new 425 425 { 426 426 return ul; 427 427 } 428 429 template<typename Mutex> 430 inline upgrade_lock<Mutex>&& move(upgrade_lock<Mutex>&& ul) 431 { 432 return ul; 433 } 428 434 #endif 429 435 430 436 template<typename Mutex> … … 662 668 { 663 669 try_lock(); 664 670 } 671 #ifdef BOOST_HAS_RVALUE_REFS 672 upgrade_lock(upgrade_lock<Mutex>&& other): 673 m(other.m),is_locked(other.is_locked) 674 { 675 other.is_locked=false; 676 other.m=0; 677 } 678 679 upgrade_lock(unique_lock<Mutex>&& other): 680 m(other.m),is_locked(other.is_locked) 681 { 682 if(is_locked) 683 { 684 m->unlock_and_lock_upgrade(); 685 } 686 other.is_locked=false; 687 other.m=0; 688 } 689 690 upgrade_lock& operator=(upgrade_lock<Mutex>&& other) 691 { 692 upgrade_lock temp(other); 693 swap(temp); 694 return *this; 695 } 696 697 upgrade_lock& operator=(unique_lock<Mutex>&& other) 698 { 699 upgrade_lock temp(other); 700 swap(temp); 701 return *this; 702 } 703 #else 665 704 upgrade_lock(detail::thread_move_t<upgrade_lock<Mutex> > other): 666 705 m(other->m),is_locked(other->is_locked) 667 706 { … … 704 743 swap(temp); 705 744 return *this; 706 745 } 746 #endif 707 747 708 748 void swap(upgrade_lock& other) 709 749 { … … 772 812 other.is_locked=false; 773 813 if(is_locked) 774 814 { 775 m .unlock_upgrade_and_lock();815 m->unlock_upgrade_and_lock(); 776 816 } 777 817 } 778 818 #else … … 808 848 } 809 849 } 810 850 851 #ifdef BOOST_HAS_RVALUE_REFS 852 upgrade_to_unique_lock(upgrade_to_unique_lock<Mutex>&& other): 853 source(other.source),exclusive(move(other.exclusive)) 854 { 855 other.source=0; 856 } 857 858 upgrade_to_unique_lock& operator=(upgrade_to_unique_lock<Mutex>&& other) 859 { 860 upgrade_to_unique_lock temp(other); 861 swap(temp); 862 return *this; 863 } 864 #else 811 865 upgrade_to_unique_lock(detail::thread_move_t<upgrade_to_unique_lock<Mutex> > other): 812 866 source(other->source),exclusive(move(other->exclusive)) 813 867 { … … 820 874 swap(temp); 821 875 return *this; 822 876 } 877 #endif 823 878 void swap(upgrade_to_unique_lock& other) 824 879 { 825 880 std::swap(source,other.source);