Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6912,8 +6912,8 @@
\rSec3[intro.progress]{Forward progress}

\pnum
The implementation may assume that any thread will eventually do one of the
following:
The implementation may assume\ubdef{intro.progress.stops} that any thread
will eventually do one of the following:
\begin{itemize}
\item terminate,
\item invoke the function \tcode{std::this_thread::yield}\iref{thread.thread.this},
Expand Down
23 changes: 23 additions & 0 deletions source/ub.tex
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,29 @@
\end{codeblock}
\end{example}

\rSec2[ub.intro.progress]{Forward progress}

\pnum
\ubxref{intro.progress.stops} \\

The behavior is undefined if a thread of execution that has not terminated stops
making execution steps.

\pnum
\begin{example}
\begin{codeblock}
bool stop() { return false; }

void busy_wait_thread() {
while (!stop()); // undefined behavior, thread makes no progress but the loop
} // is not trivial because `stop()` is not a constant expression

int main() {
std::thread t(busy_wait_thread);
t.join();
}
\end{codeblock}
\end{example}

\rSec2[ub.basic.start.main]{main function}

Expand Down