[libcxx-commits] [PATCH] D72809: [libcxx] Use mtx_plain | mtx_recursive following C11 API

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 15 14:06:20 PST 2020


phosek created this revision.
phosek added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, ldionne, christof.
Herald added a project: libc++.

The C11 API specifies that to initialize a recursive mutex,
mtx_plain | mtx_recursive should be used with mtx_init.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72809

Files:
  libcxx/include/__threading_support


Index: libcxx/include/__threading_support
===================================================================
--- libcxx/include/__threading_support
+++ libcxx/include/__threading_support
@@ -445,7 +445,7 @@
 
 int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m)
 {
-  return mtx_init(__m, mtx_recursive) == thrd_success ? 0 : EINVAL;
+  return mtx_init(__m, mtx_plain | mtx_recursive) == thrd_success ? 0 : EINVAL;
 }
 
 int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72809.238365.patch
Type: text/x-patch
Size: 504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200115/b2c47341/attachment.bin>


More information about the libcxx-commits mailing list