Changeset b4b961b in mainline
- Timestamp:
- 2018-07-05T21:41:20Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fa4a626
- Parents:
- 53c6e6a
- git-author:
- Dzejrou <dzejrou@…> (2018-03-29 14:23:24)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/mutex.hpp
r53c6e6a rb4b961b 642 642 } 643 643 644 namespace aux 645 { 646 template<class L> 647 int try_lock_tail(int idx, L& l) 648 { 649 if (!l.try_lock()) 650 return idx; 651 else 652 return -1; 653 } 654 655 template<class L1, class... L2> 656 int try_lock_tail(int idx, L1& l1, L2&... ls) 657 { 658 if (!l1.try_lock()) 659 return idx; 660 661 auto ret = try_lock_tail(idx + 1, ls...); 662 if (ret != -1) 663 l1.unlock(); 664 665 return ret; 666 } 667 } 668 644 669 template<class L1, class L2, class... L3> 645 int try_lock(L1& l1, L2& l2, L3&... ls); 670 int try_lock(L1& l1, L2& l2, L3&... ls) 671 { 672 return aux::try_lock_tail(0, l1, l2, ls...); 673 } 646 674 647 675 namespace aux
Note:
See TracChangeset
for help on using the changeset viewer.