Skip to main content
Code Review

Return to Revisions

2 of 2
replaced http://stackoverflow.com/ with https://stackoverflow.com/

Some smaller issues in addition to marcinj's Job job = std::move(queue_.front()); (which is a big thing):

  • The whiles are misleading - the loops will either run once or not at all, as the predicate-wait will only return if the predicate returns true. Use if.

  • It's more efficient to call notify_one without holding the lock. Note that this means the asserts will have to be moved upwards.

  • Virtual destructors are useless unless you are planning to use blocking_queue as a polymorphic base class. If you are worried about idiots, mark the class final.

T.C.
  • 568
  • 2
  • 8
default

AltStyle によって変換されたページ (->オリジナル) /