Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[thread.condition.condvar], [thread.condition.condvarany] Misuse of term function scope #57

Closed
sdutoit opened this issue Apr 15, 2013 · 2 comments
Assignees
Labels
lwg Issue must be reviewed by LWG.

Comments

@sdutoit
Copy link
Contributor

sdutoit commented Apr 15, 2013

From an email to cxxeditor@:

Discussed here: https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/JpQVT-pwP9E

N3485

3.3.5 Function scope [basic.funscope]
1 Labels (6.1) have function scope and may be used anywhere in the function in which they are declared. Only labels have function scope.

30.5.1 Class condition_variable [thread.condition.condvar]
10 Effects:
— Atomically calls lock.unlock() and blocks on *this.
— When unblocked, calls lock.lock() (possibly blocking on the lock), then returns.
— The function will unblock when signaled by a call to notify_one() or a call to notify_all(), or spuriously.
— If the function exits via an exception, lock.lock() shall be called prior to exiting the function scope.
20 Effects:
— Atomically calls lock.unlock() and blocks on *this.
— When unblocked, calls lock.lock() (possibly blocking on the lock), then returns.
— The function will unblock when signaled by a call to notify_one(), a call to notify_all(), expiration of the absolute timeout (30.2.4) specified by abs_time, or spuriously.
— If the function exits via an exception, lock.lock() shall be called prior to exiting the function scope.

30.5.2 Class condition_variable_any [thread.condition.condvarany]
10 Effects:
— Atomically calls lock.unlock() and blocks on *this.
— When unblocked, calls lock.lock() (possibly blocking on the lock) and returns.
— The function will unblock when signaled by a call to notify_one(), a call to notify_all(), or spuriously.
— If the function exits via an exception, lock.lock() shall be called prior to exiting the function scope.
15 Effects:
— Atomically calls lock.unlock() and blocks on *this.
— When unblocked, calls lock.lock() (possibly blocking on the lock) and returns.
— The function will unblock when signaled by a call to notify_one(), a call to notify_all(), expiration of the absolute timeout (30.2.4) specified by abs_time, or spuriously.
— If the function exits via an exception, lock.lock() shall be called prior to exiting the function scope.

The use of "function scope" in [thread.condition] is conflict with the description in [basic.funscope]. Probably the former should be "outermost block scope of the function".

@jwakely
Copy link
Member

jwakely commented Jun 18, 2014

This was also reported as a library issue http://cplusplus.github.io/LWG/lwg-defects.html#2240

@burblebee burblebee added the lwg Issue must be reviewed by LWG. label Apr 15, 2016
@burblebee
Copy link
Contributor

This was fixed by LWG2240.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lwg Issue must be reviewed by LWG.
Projects
None yet
Development

No branches or pull requests

4 participants