Skip to content

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

@sdutoit

Description

@sdutoit

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".

Metadata

Metadata

Assignees

Labels

lwgIssue must be reviewed by LWG.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions