Guest User

Untitled

a guest
May 25th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. struct my_class
  2. {
  3. mutable boost::mutex m;
  4. int x,y;
  5. };
  6. bool operator<(my_class const& lhs,my_class const& rhs)
  7. {
  8. boost::lock(lhs.m,rhs.m);
  9. boost::mutex::scoped_lock lk1(lhs.m,boost::adopt_lock);
  10. boost::mutex::scoped_lock lk2(rhs.m,boost::adopt_lock);
  11. return (lhs.x<rhs.x) ||
  12. ((lhs.x==rhs.x) && (lhs.y<rhs.y));
  13. }
Add Comment
Please, Sign In to add comment