Title
Unclear phrasing "may assume ... eventually"
Status
review
Section
6.9.2.3 [intro.progress]
Submitter
Jiang An

Created on 2023-04-26.00:00:00 last changed 4 months ago

Messages

Date: 2023-12-16.00:18:01

Subclause 6.9.2.3 [intro.progress] paragraph 1 specifies:

The implementation may assume that any thread will eventually do one of the following:
  • terminate,
  • make a call to a library I/O function,
  • perform an access through a volatile glvalue, or
  • perform a synchronization operation or an atomic operation.

This formulation has two issues. First, what are the consequences of the user violation the assumption? It should be clearly specified that undefined behavior results. Second, what does "eventually" mean? The wording gives the impression that the requirement is satisfied if a thread performs some I/O operation at its beginning and then goes into an empty infinite loop.

It was also noted that that 6.9.2.3 [intro.progress] paragraph 3 is a near-duplicate of paragraph 1.

Possible resolution:

  1. Remove 6.9.2.3 [intro.progress] paragraph 1:

    The implementation may assume that any thread will eventually do one of the following:
    • terminate,
    • make a call to a library I/O function,
    • perform an access through a volatile glvalue, or
    • perform a synchronization operation or an atomic operation.
    [Note 1: This is intended to allow compiler transformations such as removal of empty loops, even when termination cannot be proven. —end note]
  2. Change in 6.9.2.3 [intro.progress] paragraph 5 as follows:

    The behavior is undefined if a thread of execution that has not terminated stops making execution steps. [Note: This is intended to allow compiler transformations such as removal of empty loops, even when termination cannot be proven. Because of this and the preceding requirement regarding what threads of execution have to perform eventually, it It follows that no thread of execution can execute forever without an execution step occurring. —end note]
History
Date User Action Args
2023-12-16 00:18:01adminsetstatus: open -> review
2023-04-26 00:00:00admincreate