[RFC,12/13] support: implement xpthread key create/delete (v3)
Commit Message
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.
---
ChangeLog.old/ChangeLog.19 | 8 ++++++++
support/Makefile | 2 ++
support/xpthread_key_create.c | 25 +++++++++++++++++++++++++
support/xpthread_key_delete.c | 24 ++++++++++++++++++++++++
support/xthread.h | 2 ++
5 files changed, 61 insertions(+)
create mode 100644 support/xpthread_key_create.c
create mode 100644 support/xpthread_key_delete.c
Comments
* Mathieu Desnoyers:
> diff --git a/ChangeLog.old/ChangeLog.19 b/ChangeLog.old/ChangeLog.19
> index 07c6aff585..ae2e4af636 100644
> --- a/ChangeLog.old/ChangeLog.19
> +++ b/ChangeLog.old/ChangeLog.19
> @@ -1,3 +1,11 @@
> +2019-12-17 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +
> + * support/Makefile: Add xpthread_key_create and xpthread_key_delete.
> + * support/xthread.h: Add prototype for xpthread_key_create and
> + xpthread_key_delete.
> + * support/xpthread_key_create.c: New file.
> + * support/xpthread_key_delete.c: New file.
> +
Please remove the ChangeLog update. Otherwise okay.
----- On Dec 21, 2019, at 4:51 AM, Florian Weimer fw@deneb.enyo.de wrote:
> * Mathieu Desnoyers:
>
>> diff --git a/ChangeLog.old/ChangeLog.19 b/ChangeLog.old/ChangeLog.19
>> index 07c6aff585..ae2e4af636 100644
>> --- a/ChangeLog.old/ChangeLog.19
>> +++ b/ChangeLog.old/ChangeLog.19
>> @@ -1,3 +1,11 @@
>> +2019-12-17 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +
>> + * support/Makefile: Add xpthread_key_create and xpthread_key_delete.
>> + * support/xthread.h: Add prototype for xpthread_key_create and
>> + xpthread_key_delete.
>> + * support/xpthread_key_create.c: New file.
>> + * support/xpthread_key_delete.c: New file.
>> +
>
> Please remove the ChangeLog update. Otherwise okay.
Should I remove changelog updates from all my patches ?
Thanks,
Mathieu
* Mathieu Desnoyers:
> ----- On Dec 21, 2019, at 4:51 AM, Florian Weimer fw@deneb.enyo.de wrote:
>
>> * Mathieu Desnoyers:
>>
>>> diff --git a/ChangeLog.old/ChangeLog.19 b/ChangeLog.old/ChangeLog.19
>>> index 07c6aff585..ae2e4af636 100644
>>> --- a/ChangeLog.old/ChangeLog.19
>>> +++ b/ChangeLog.old/ChangeLog.19
>>> @@ -1,3 +1,11 @@
>>> +2019-12-17 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>>> +
>>> + * support/Makefile: Add xpthread_key_create and xpthread_key_delete.
>>> + * support/xthread.h: Add prototype for xpthread_key_create and
>>> + xpthread_key_delete.
>>> + * support/xpthread_key_create.c: New file.
>>> + * support/xpthread_key_delete.c: New file.
>>> +
>>
>> Please remove the ChangeLog update. Otherwise okay.
>
> Should I remove changelog updates from all my patches ?
Yes, please. Please double-check that relevant information is
included in the commit message. But the changed entities do not need
to be listed there.
@@ -1,3 +1,11 @@
+2019-12-17 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+
+ * support/Makefile: Add xpthread_key_create and xpthread_key_delete.
+ * support/xthread.h: Add prototype for xpthread_key_create and
+ xpthread_key_delete.
+ * support/xpthread_key_create.c: New file.
+ * support/xpthread_key_delete.c: New file.
+
2019-12-17 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* sysdeps/unix/sysv/linux/sched_getcpu.c: use rseq cpu_id TLS on
@@ -127,6 +127,8 @@ libsupport-routines = \
xpthread_create \
xpthread_detach \
xpthread_join \
+ xpthread_key_create \
+ xpthread_key_delete \
xpthread_mutex_consistent \
xpthread_mutex_destroy \
xpthread_mutex_init \
new file mode 100644
@@ -0,0 +1,25 @@
+/* pthread_key_create with error checking.
+ Copyright (C) 2019 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_create (pthread_key_t *key, void (*destr_function) (void *))
+{
+ xpthread_check_return ("pthread_key_create",
+ pthread_key_create (key, destr_function));
+}
new file mode 100644
@@ -0,0 +1,24 @@
+/* pthread_key_delete with error checking.
+ Copyright (C) 2019 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));
+}
@@ -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);
+void xpthread_key_create (pthread_key_t *key, void (*destr_function) (void *));
+void xpthread_key_delete (pthread_key_t key);
__END_DECLS