A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue1497 below:

lock() postcondition can not be generally achieved

Change 32.7.4 [thread.condition.condvar] as indicated:
void wait(unique_lock<mutex>& lock);

9 Requires: lock .owns_lock() is true and lock.mutex() is locked by the calling thread, and either

[..]

11 Postcondition: lock .owns_lock() is true and lock.mutex() is locked by the calling thread.

[..]
template <class Predicate>
void wait(unique_lock<mutex>& lock, Predicate pred);

?? Requires: lock.owns_lock() is true and lock.mutex() is locked by the calling thread, and either

14 Effects:

while (!pred())
  wait(lock);

?? Postcondition: lock.owns_lock() is true and lock.mutex() is locked by the calling thread.

?? Throws: std::system_error when an exception is required (30.2.2).

?? Error conditions:

template <class Clock, class Duration>
cv_status wait_until(unique_lock<mutex>& lock,
  const chrono::time_point<Clock, Duration>& abs_time);

15 Requires: lock .owns_lock() is true and lock.mutex() is locked by the calling thread, and either

[..]

17 Postcondition: lock .owns_lock() is true and lock.mutex() is locked by the calling thread.

[..]

20 Error conditions:

template <class Rep, class Period>
cv_status wait_for(unique_lock<mutex>& lock,
  const chrono::duration<Rep, Period>& rel_time);

21 Requires: lock .owns_lock() is true and lock.mutex() is locked by the calling thread, and either

[..]

24 Postcondition: lock .owns_lock() is true and lock.mutex() is locked by the calling thread.

[..]

26 Error conditions:

template <class Clock, class Duration, class Predicate>
bool wait_until(unique_lock<mutex>& lock,
  const chrono::time_point<Clock, Duration>& abs_time,
    Predicate pred);

?? Requires: lock.owns_lock() is true and lock.mutex() is locked by the calling thread, and either

27 Effects:

while (!pred())
  if (wait_until(lock, abs_time) == cv_status::timeout)
    return pred();
return true;

28 Returns: pred()

?? Postcondition: lock.owns_lock() is true and lock.mutex() is locked by the calling thread.

29 [ Note: The returned value indicates whether the predicate evaluates to true regardless of whether the timeout was triggered. — end note ]

?? Throws: std::system_error when an exception is required (30.2.2).

?? Error conditions:

template <class Rep, class Period, class Predicate>
bool wait_for(unique_lock<mutex>& lock,
  const chrono::duration<Rep, Period>& rel_time,
    Predicate pred);

30 Requires: lock .owns_lock() is true and lock.mutex() is locked by the calling thread, and either

[..]

33 Postcondition: lock .owns_lock() is true and lock.mutex() is locked by the calling thread.

[..]

37 Error conditions:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4