From patchwork Fri Sep 22 20:26:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 114091 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp3473766edb; Fri, 22 Sep 2017 13:27:48 -0700 (PDT) X-Received: by 10.101.81.1 with SMTP id f1mr313611pgq.204.1506112068359; Fri, 22 Sep 2017 13:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506112068; cv=none; d=google.com; s=arc-20160816; b=CVvx8XZ17AnTHNDzU21BKTaiyhocBRFIuYvx022JXpNeSY4AdaRcP7Min1pmIk7p+I XJgSo6P4N74ebhnL6WOVbxX1P6ZIFTbK/lK7qmHc/36WT/I+PlvK2GDOYokdapbr8qNA I9E7TdjJQKerx8j3pl1LJ8ddxX9tcj8Nn6JQ+N/xxErkkEVr3ouhd96HUxUW628BhEhA CGTUXuKjEMJOuevye3Ay4IGRB26hVeY1dXNehg+X0WwGWwGFCsUBH9LPpIKHpCrz9Upj 6jvBH5dUPga3e028RPKiY0Kw68YlZq9rf5K/rjQjhw9pd8T7OVzyJnfKhre6OCNs9woI qSWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=Kv62uBou1JeU/l1U9IFZ4uQ2l8+uhdlle++NCjKX9lA=; b=f/8PqFi0Em001k5ZkO+09PhqUxLIFkIfd6pSsV/xl/RSSVk0ob5ybo1LmgNZEqNdHW Dd9QAnN52LAnFi/SLU0O+fbrQ1qMWr39jVcHQ29bUCHeTOpKKyn8UicFzSpB+1SKY7Yj 6f7yqMDIJr36bEs2kBxHBQ6tepb/rd6zFZZvPiidxWtp9KRfCo7Rd9teur0lqHEOIoIB fO5nG2c7Xz6H4NWsng7Vpp+QUcyoI7GjabptRsFmdaDduLGlHaP6rWpYWHOSoglziNSS RCX01RFrXg4e16Kv6DTMKMF+Jh4Yy9IZik+8nPgELslVyhItWmwZKcaATCKdWyaCdqMY CfAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=fFBSGJXx; spf=pass (google.com: domain of libc-alpha-return-84875-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-84875-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id l22si324787pfk.589.2017.09.22.13.27.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 13:27:48 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-84875-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=fFBSGJXx; spf=pass (google.com: domain of libc-alpha-return-84875-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-84875-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=h/4NEXpy6I1V3ZKtPJsygKyJTIh57t0 ttZKST+DL7GAZOIOAeii/bBVSl3YxSeUEow4hBV4H74rQGOY8N2JIm7ROKQNEoFu FtSovDayEzoFLHsksigQLMPh70/Tehg7Fwj80BuHECMswwkXZml5Av6ysJEwHvzc YGNhqfGMk2Qs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=JGO/TCz87FI0EaMaBGCKCDpKEFQ=; b=fFBSG JXxC+II9JGwPYBroLDNkf9sb0UIoNEVACkUYG6HmqYrGfZsQJw1ORKcvP47eA7oM d/gYDqIt9mK8AwZ0/dhrbkfbWly14JJC/2U0YQ2egQsflszsaDSyZ43UIPiXHp3/ L/FJqJ15St0ummRdtHjZ5DEh3Hw1YSiB1UERW8= Received: (qmail 65926 invoked by alias); 22 Sep 2017 20:27:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 65859 invoked by uid 89); 22 Sep 2017 20:27:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f174.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Kv62uBou1JeU/l1U9IFZ4uQ2l8+uhdlle++NCjKX9lA=; b=ISHMGFiVcy7SliB54bchI59DTdH47F4eIeZ/yqp/686DBahmUYT/5V47C/u0N2KEeU o7RB7FWhHexnkqTVWNO3S4bFEfYr08qnokdQ2fMVrUIubV9XWzcdskBfygF6o8qAiutV fXGDXF5vXVyX96tueHop9L45yOcxEWeYf0FK/rHElT2Xvi5CiRA1cOxAS6QeCVxtuZFf 7FtYB81dpJrIdeJtWpIXAZ6gERpBbvwQ536BYbJknPTQkM1pYWQEnC8q0ELdtzIYkl3q sDzS9OsWI7mcLnWllQqkyQMMtlkqBdK1M5XB6qfzKrf8DYsXbrL/LQwaeim3N17jwgSh plww== X-Gm-Message-State: AHPjjUgV2jTGJepwRWUIRtLPh9VFYSAva984uAhOel3q2O9Fn9uiDEeR yl59bpsr/KbFnXScwXmRTSvfr27T4XA= X-Google-Smtp-Source: AOwi7QBBgB1ATirIYt+KVazjEpMhG1rw8lvBkCxl3c/buxQE0pQ4wda/WxTV6tUzWyWv5d6bl1fTHA== X-Received: by 10.200.38.110 with SMTP id v43mr614915qtv.296.1506112034857; Fri, 22 Sep 2017 13:27:14 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/8] nptl: Add C11 threads mtx_* functions Date: Fri, 22 Sep 2017 17:26:58 -0300 Message-Id: <1506112024-22601-3-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1506112024-22601-1-git-send-email-adhemerval.zanella@linaro.org> References: <1506112024-22601-1-git-send-email-adhemerval.zanella@linaro.org> This patch adds the mtx_* definitions from C11 threads (ISO/IEC 9899:2011), more specifically mtx_init, mtx_destroy, mtx_lock, mtx_timedlock, mtx_trylock, mtx_unlock, and required types. Mostly of the definitions are composed based on POSIX conterparts, and mtx_t is also based on internal pthread fields, but with a distinct internal layout to avoid possible issues with code interchange (such as trying to pass POSIX structure on C11 functions and to avoid inclusion of pthread.h). The idea is to make possible to share POSIX internal implementations for mostly of the code (and making adjustment only when required). Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, tile{pro,gx}-linux-gnu, and x86_64-linux-gnu). Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabhf, and powerpc64le-linux-gnu. * conform/data/threads.h-data (mtx_plain): New constant. (mtx_recursive): Likewise. (mtx_timed): Likewise. (mtx_t): New type. (mtx_init): New function. (mtx_lock): Likewise. (mtx_timedlock): Likewise. (mtx_trylock): Likewise. (mtx_unlock): Likewise. (mtx_destroy): Likewise. * nptl/Makefile (libpthread-routines): Add mtx_destroy, mtx_init, mtx_lock, mtx_timedlock, mtx_trylock, and mtx_unlock object. * nptl/Versions (libpthread) [GLIBC_2.27]): Add mtx_init, mtx_lock, mtx_timedlock, mtx_trylock, mtx_unlock, and mtx_destroy. * nptl/mtx_destroy.c: New file. * nptl/mtx_init.c: Likewise. * nptl/mtx_lock.c: Likewise. * nptl/mtx_timedlock.c: Likewise. * nptl/mtx_trylock.c: Likewise. * nptl/mtx_unlock.c: Likewise. * sysdeps/nptl/threads.h (mtx_plain): New enumeration. (mtx_recursive): Likewise. (mtx_timed): Likewise. (mtx_t): New type. (mtx_init): New prototype. (mtx_lock): Likewise. (mtx_timedlock): Likewise. (mtx_trylock): Likewise. (mtx_unlock): Likewise. (mtx_destroy): Likewise. --- ChangeLog | 31 ++++++++++++++++++++++++++ conform/data/threads.h-data | 12 ++++++++++ nptl/Makefile | 4 +++- nptl/Versions | 3 ++- nptl/mtx_destroy.c | 27 +++++++++++++++++++++++ nptl/mtx_init.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ nptl/mtx_lock.c | 28 +++++++++++++++++++++++ nptl/mtx_timedlock.c | 31 ++++++++++++++++++++++++++ nptl/mtx_trylock.c | 29 ++++++++++++++++++++++++ nptl/mtx_unlock.c | 28 +++++++++++++++++++++++ sysdeps/nptl/threads.h | 44 ++++++++++++++++++++++++++++++++++++ 11 files changed, 289 insertions(+), 2 deletions(-) create mode 100644 nptl/mtx_destroy.c create mode 100644 nptl/mtx_init.c create mode 100644 nptl/mtx_lock.c create mode 100644 nptl/mtx_timedlock.c create mode 100644 nptl/mtx_trylock.c create mode 100644 nptl/mtx_unlock.c -- 2.7.4 diff --git a/conform/data/threads.h-data b/conform/data/threads.h-data index bc2d857..bb5ca75 100644 --- a/conform/data/threads.h-data +++ b/conform/data/threads.h-data @@ -6,8 +6,13 @@ constant thrd_error constant thrd_nomem constant thrd_timedout +constant mtx_plain +constant mtx_recursive +constant mtx_timed + type thrd_t type thrd_start_t +type mtx_t function int thrd_create (thrd_t*, thrd_start_t, void*) function int thrd_equal (thrd_t, thrd_t) @@ -18,6 +23,13 @@ function int thrd_detach (thrd_t) function int thrd_join (thrd_t, int*) function void thrd_yield (void) +function int mtx_init (mtx_t*, int) +function int mtx_lock (mtx_t*) +function int mtx_timedlock (mtx_t*, const struct timespec*) +function int mtx_trylock (mtx_t*) +function int mtx_unlock (mtx_t*) +function void mtx_destroy (mtx_t*) + #include "time.h-data" #endif diff --git a/nptl/Makefile b/nptl/Makefile index 31761a6..c4f6970 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -140,7 +140,9 @@ libpthread-routines = nptl-init vars events version pt-interp \ pthread_setname pthread_getname \ pthread_setattr_default_np pthread_getattr_default_np \ thrd_create thrd_current thrd_detach thrd_equal \ - thrd_exit thrd_join thrd_sleep thrd_yield + thrd_exit thrd_join thrd_sleep thrd_yield \ + mtx_destroy mtx_init mtx_lock mtx_timedlock \ + mtx_trylock mtx_unlock # pthread_setuid pthread_seteuid pthread_setreuid \ # pthread_setresuid \ # pthread_setgid pthread_setegid pthread_setregid \ diff --git a/nptl/Versions b/nptl/Versions index a282ceb..5cf581a 100644 --- a/nptl/Versions +++ b/nptl/Versions @@ -268,7 +268,8 @@ libpthread { # C11 thread symbols. GLIBC_2.27 { thrd_create; thrd_current; thrd_detach; thrd_equal; thrd_exit; thrd_join; - thrd_sleep; thrd_yield; + thrd_sleep; thrd_yield; mtx_init; mtx_lock; mtx_timedlock; mtx_trylock; + mtx_unlock; mtx_destroy; } GLIBC_PRIVATE { diff --git a/nptl/mtx_destroy.c b/nptl/mtx_destroy.c new file mode 100644 index 0000000..1fcc534 --- /dev/null +++ b/nptl/mtx_destroy.c @@ -0,0 +1,27 @@ +/* C11 threads mutex destroy implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "thrd_priv.h" +#include "pthreadP.h" + +/* Destroy the mutex object pointed by mutex. */ +void +mtx_destroy (mtx_t *mutex) +{ + __pthread_mutex_destroy ((pthread_mutex_t *) mutex); +} diff --git a/nptl/mtx_init.c b/nptl/mtx_init.c new file mode 100644 index 0000000..da27156 --- /dev/null +++ b/nptl/mtx_init.c @@ -0,0 +1,54 @@ +/* C11 threads mutex initialization implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#include "thrd_priv.h" + +/* Creates a new mutex object with type type. If successful the new object + is pointed by mutex. */ +int +mtx_init (mtx_t *mutex, int type) +{ + _Static_assert (sizeof (mtx_t) == sizeof (pthread_mutex_t), "mtx_t size"); + _Static_assert (alignof (mtx_t) == alignof (pthread_mutex_t), + "mtx_t alignment"); + + pthread_mutexattr_t attr; + + __pthread_mutexattr_init (&attr); + + /* Another possible solution would be to set the flags directly in + mutex object. */ + switch (type) + { + case mtx_plain | mtx_recursive: + case mtx_timed | mtx_recursive: + __pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); + break; + case mtx_plain: + case mtx_timed: /* No difference between both in standard */ + default: + __pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_NORMAL); + break; + } + + int err_code = __pthread_mutex_init ((pthread_mutex_t *) mutex, &attr); + /* pthread_mutexattr_destroy implementation is a noop. */ + return thrd_err_map (err_code); +} diff --git a/nptl/mtx_lock.c b/nptl/mtx_lock.c new file mode 100644 index 0000000..bd4c530 --- /dev/null +++ b/nptl/mtx_lock.c @@ -0,0 +1,28 @@ +/* C11 threads mutex lock implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "thrd_priv.h" + +/* Block the current thread until the mutex pointed to by mutex is + unlocked. In that case current thread will not be blocked. */ +int +mtx_lock (mtx_t *mutex) +{ + int err_code = __pthread_mutex_lock ((pthread_mutex_t *) mutex); + return thrd_err_map (err_code); +} diff --git a/nptl/mtx_timedlock.c b/nptl/mtx_timedlock.c new file mode 100644 index 0000000..3770d5c --- /dev/null +++ b/nptl/mtx_timedlock.c @@ -0,0 +1,31 @@ +/* C11 threads mutex timed lock implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "thrd_priv.h" + +/* Block the current thread until the mutex pointed by mutex is unlocked + or time pointed by time_point is reached. In case the mutex is unlocked + current thread will not be blocked. */ +int +mtx_timedlock (mtx_t *restrict mutex, + const struct timespec *restrict time_point) +{ + int err_code = __pthread_mutex_timedlock ((pthread_mutex_t *)mutex, + time_point); + return thrd_err_map (err_code); +} diff --git a/nptl/mtx_trylock.c b/nptl/mtx_trylock.c new file mode 100644 index 0000000..406229a --- /dev/null +++ b/nptl/mtx_trylock.c @@ -0,0 +1,29 @@ +/* C11 threads mutex try lock implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "thrd_priv.h" + +/* Try to lock the mutex pointed by mutex without blocking. If the mutex + is free the current threads takes control of it, otherwise it returns + immediately. */ +int +mtx_trylock (mtx_t *mutex) +{ + int err_code = __pthread_mutex_trylock ((pthread_mutex_t *) mutex); + return thrd_err_map (err_code); +} diff --git a/nptl/mtx_unlock.c b/nptl/mtx_unlock.c new file mode 100644 index 0000000..d5f9c32 --- /dev/null +++ b/nptl/mtx_unlock.c @@ -0,0 +1,28 @@ +/* C11 threads mutex unlock implementation. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "thrd_priv.h" + +/* Unlock the mutex pointed by mutex. It may potentially awake other + threads waiting on this mutex. */ +int +mtx_unlock (mtx_t *mutex) +{ + int err_code = __pthread_mutex_unlock ((pthread_mutex_t *) mutex); + return thrd_err_map (err_code); +} diff --git a/sysdeps/nptl/threads.h b/sysdeps/nptl/threads.h index 4b89a30..cd811f4 100644 --- a/sysdeps/nptl/threads.h +++ b/sysdeps/nptl/threads.h @@ -24,6 +24,7 @@ __BEGIN_DECLS +#include #include typedef unsigned long int thrd_t; @@ -39,6 +40,20 @@ enum thrd_timedout = 4 }; +/* Mutex types. */ +enum +{ + mtx_plain = 0, + mtx_recursive = 1, + mtx_timed = 2 +}; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_MUTEX_T]; + long int __align __LOCK_ALIGNMENT; +} mtx_t; + /* Threads functions. */ /* Create a new thread executing the function __func. Arguments to __func @@ -85,6 +100,35 @@ thrd_equal (thrd_t __thread1, thrd_t __thread2) } #endif + +/* Mutex functions. */ + +/* Creates a new mutex object with type __type. If successful the new + object is pointed by __mutex. */ +extern int mtx_init (mtx_t *__mutex, int __type); + +/* Block the current thread until the mutex pointed to by __mutex is + unlocked. In that case current thread will not be blocked. */ +extern int mtx_lock (mtx_t *__mutex); + +/* Block the current thread until the mutex pointed by __mutex is unlocked + or time pointed by __time_point is reached. In case the mutex is unlock, + the current thread will not be blocked. */ +extern int mtx_timedlock (mtx_t *__restrict __mutex, + const struct timespec *__restrict __time_point); + +/* Try to lock the mutex pointed by __mutex without blocking. If the mutex + is free the current threads takes control of it, otherwise it returns + immediately. */ +extern int mtx_trylock (mtx_t *__mutex); + +/* Unlock the mutex pointed by __mutex. It may potentially awake other + threads waiting on this mutex. */ +extern int mtx_unlock (mtx_t *__mutex); + +/* Destroy the mutex object pointed by __mutex. */ +extern void mtx_destroy (mtx_t *__mutex); + __END_DECLS #endif /* _THREADS_H */