[all-commits] [llvm/llvm-project] 780363: [libcxx testing] Fix UB in tests for std::lock_guard

Igor Kudrin via All-commits all-commits at lists.llvm.org
Fri Jan 15 01:16:46 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 78036360573c35ea9e6a697d2eed92db893b4850
      https://github.com/llvm/llvm-project/commit/78036360573c35ea9e6a697d2eed92db893b4850
  Author: Igor Kudrin <ikudrin at accesssoftek.com>
  Date:   2021-01-15 (Fri, 15 Jan 2021)

  Changed paths:
    M libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/adopt_lock.pass.cpp
    M libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/mutex.pass.cpp

  Log Message:
  -----------
  [libcxx testing] Fix UB in tests for std::lock_guard

If mutex::try_lock() is called in a thread that already owns the mutex,
the behavior is undefined. The patch fixes the issue by creating another
thread, where the call is allowed.

Differential Revision: https://reviews.llvm.org/D94656




More information about the All-commits mailing list