[all-commits] [llvm/llvm-project] 1bb85f: [libc] Lock the output stream for the 'puts' call ...

Joseph Huber via All-commits all-commits at lists.llvm.org
Tue Jan 2 08:07:15 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1bb85fa9c038044e949dac6e3b07e9835d1110a6
      https://github.com/llvm/llvm-project/commit/1bb85fa9c038044e949dac6e3b07e9835d1110a6
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2024-01-02 (Tue, 02 Jan 2024)

  Changed paths:
    M libc/src/stdio/generic/puts.cpp

  Log Message:
  -----------
  [libc] Lock the output stream for the 'puts' call (#76513)

Summary:
The `puts` function consists of an initial write and then another write
to append the newline. When executing code in parallel, it is possible
for these writes to becomes disjointed. This code adds an explicit lock
call to ensure that the string is always appended by the newline as the
users expects.

Wasn't sure if this required a test as it would be difficult since
reproducing it would be flaky.




More information about the All-commits mailing list