* [PATCH glibc 1/1] support: implement xpthread key create/delete (v5)
@ 2020-04-27 17:30 Mathieu Desnoyers
2020-04-27 19:09 ` Florian Weimer
0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Desnoyers @ 2020-04-27 17:30 UTC (permalink / raw)
To: Carlos O'Donell
Cc: Florian Weimer, Joseph Myers, Szabolcs Nagy, libc-alpha,
Mathieu Desnoyers
Expose xpthread_key_create () and xpthread_key_delete () wrappers
for tests.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Carlos O'Donell <carlos@redhat.com>
CC: Florian Weimer <fweimer@redhat.com>
CC: Joseph Myers <joseph@codesourcery.com>
CC: Szabolcs Nagy <szabolcs.nagy@arm.com>
CC: libc-alpha@sourceware.org
---
Changes since v1:
- Update ChangeLog.
- Wrap long line in xpthread_key_create.
Changes since v2:
- Rebase on glibc 2.30.
Changes since v3:
- Update copyright range to include 2020.
Changes since v4:
- Update copyright date to specifically only 2020.
- Change xpthread_key_create prototype to return a pthread_key_t,
similarly to what has been done for xpthread_create.
---
support/Makefile | 2 ++
support/xpthread_key_create.c | 28 ++++++++++++++++++++++++++++
support/xpthread_key_delete.c | 24 ++++++++++++++++++++++++
support/xthread.h | 2 ++
4 files changed, 56 insertions(+)
create mode 100644 support/xpthread_key_create.c
create mode 100644 support/xpthread_key_delete.c
diff --git a/support/Makefile b/support/Makefile
index 9364f3bd3e..51484310cd 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -130,6 +130,8 @@ libsupport-routines = \
xpthread_create \
xpthread_detach \
xpthread_join \
+ xpthread_key_create \
+ xpthread_key_delete \
xpthread_mutex_consistent \
xpthread_mutex_destroy \
xpthread_mutex_init \
diff --git a/support/xpthread_key_create.c b/support/xpthread_key_create.c
new file mode 100644
index 0000000000..799d8f1bc4
--- /dev/null
+++ b/support/xpthread_key_create.c
@@ -0,0 +1,28 @@
+/* pthread_key_create with error checking.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <support/xthread.h>
+
+pthread_key_t
+xpthread_key_create (void (*destr_function) (void *))
+{
+ pthread_key_t key;
+
+ xpthread_check_return ("pthread_key_create",
+ pthread_key_create (&key, destr_function));
+ return key;
+}
diff --git a/support/xpthread_key_delete.c b/support/xpthread_key_delete.c
new file mode 100644
index 0000000000..559fc2c492
--- /dev/null
+++ b/support/xpthread_key_delete.c
@@ -0,0 +1,24 @@
+/* pthread_key_delete with error checking.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <support/xthread.h>
+
+void
+xpthread_key_delete (pthread_key_t key)
+{
+ xpthread_check_return ("pthread_key_delete", pthread_key_delete (key));
+}
diff --git a/support/xthread.h b/support/xthread.h
index d350d1506d..05f8d4a7d9 100644
--- a/support/xthread.h
+++ b/support/xthread.h
@@ -95,6 +95,8 @@ void xpthread_rwlock_wrlock (pthread_rwlock_t *rwlock);
void xpthread_rwlock_rdlock (pthread_rwlock_t *rwlock);
void xpthread_rwlock_unlock (pthread_rwlock_t *rwlock);
void xpthread_rwlock_destroy (pthread_rwlock_t *rwlock);
+pthread_key_t xpthread_key_create (void (*destr_function) (void *));
+void xpthread_key_delete (pthread_key_t key);
__END_DECLS
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH glibc 1/1] support: implement xpthread key create/delete (v5)
2020-04-27 17:30 [PATCH glibc 1/1] support: implement xpthread key create/delete (v5) Mathieu Desnoyers
@ 2020-04-27 19:09 ` Florian Weimer
2020-04-27 19:17 ` Mathieu Desnoyers
0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2020-04-27 19:09 UTC (permalink / raw)
To: Mathieu Desnoyers via Libc-alpha
Cc: Carlos O'Donell, Mathieu Desnoyers, Joseph Myers
* Mathieu Desnoyers via Libc-alpha:
> Expose xpthread_key_create () and xpthread_key_delete () wrappers
> for tests.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> CC: Carlos O'Donell <carlos@redhat.com>
> CC: Florian Weimer <fweimer@redhat.com>
> CC: Joseph Myers <joseph@codesourcery.com>
> CC: Szabolcs Nagy <szabolcs.nagy@arm.com>
> CC: libc-alpha@sourceware.org
Sorry, one more nit: This patch adds some http:// URLs, we've since
switched to https://.
(I ran an outdated version of my checker script by accident.)
Can you push this yourself? I can push it for you with that change
(and without the Signed-off-by:).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH glibc 1/1] support: implement xpthread key create/delete (v5)
2020-04-27 19:09 ` Florian Weimer
@ 2020-04-27 19:17 ` Mathieu Desnoyers
0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Desnoyers @ 2020-04-27 19:17 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-alpha, Carlos O'Donell, Joseph Myers
----- On Apr 27, 2020, at 3:09 PM, Florian Weimer fw@deneb.enyo.de wrote:
> * Mathieu Desnoyers via Libc-alpha:
>
>> Expose xpthread_key_create () and xpthread_key_delete () wrappers
>> for tests.
>>
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> CC: Carlos O'Donell <carlos@redhat.com>
>> CC: Florian Weimer <fweimer@redhat.com>
>> CC: Joseph Myers <joseph@codesourcery.com>
>> CC: Szabolcs Nagy <szabolcs.nagy@arm.com>
>> CC: libc-alpha@sourceware.org
>
> Sorry, one more nit: This patch adds some http:// URLs, we've since
> switched to https://.
>
> (I ran an outdated version of my checker script by accident.)
>
> Can you push this yourself? I can push it for you with that change
> (and without the Signed-off-by:).
Updated version sent to the list, thanks!
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-27 19:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 17:30 [PATCH glibc 1/1] support: implement xpthread key create/delete (v5) Mathieu Desnoyers
2020-04-27 19:09 ` Florian Weimer
2020-04-27 19:17 ` Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).