unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Carlos O'Donell <carlos@redhat.com>
Cc: Florian Weimer <fweimer@redhat.com>,
	Joseph Myers <joseph@codesourcery.com>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>,
	libc-alpha@sourceware.org,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: [RFC PATCH glibc 12/13] support: implement xpthread key create/delete (v3)
Date: Mon,  6 Jan 2020 10:57:12 -0500	[thread overview]
Message-ID: <20200106155713.397-13-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <20200106155713.397-1-mathieu.desnoyers@efficios.com>

Expose xpthread_key_create () and xpthread_key_delete () wrappers
for tests.

	* 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.

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.
---
 support/Makefile              |  2 ++
 support/xpthread_key_create.c | 25 +++++++++++++++++++++++++
 support/xpthread_key_delete.c | 24 ++++++++++++++++++++++++
 support/xthread.h             |  2 ++
 4 files changed, 53 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 23c6d74627..affc598c65 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -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 \
diff --git a/support/xpthread_key_create.c b/support/xpthread_key_create.c
new file mode 100644
index 0000000000..fb5a89ab3a
--- /dev/null
+++ b/support/xpthread_key_create.c
@@ -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));
+}
diff --git a/support/xpthread_key_delete.c b/support/xpthread_key_delete.c
new file mode 100644
index 0000000000..423ff4584d
--- /dev/null
+++ b/support/xpthread_key_delete.c
@@ -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));
+}
diff --git a/support/xthread.h b/support/xthread.h
index f39720cb23..4be86b39a0 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);
+void xpthread_key_create (pthread_key_t *key, void (*destr_function) (void *));
+void xpthread_key_delete (pthread_key_t key);
 
 __END_DECLS
 
-- 
2.17.1


  parent reply	other threads:[~2020-01-06 15:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 15:57 [RFC PATCH glibc 00/13] Restartable Sequences enablement Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 01/13] Introduce <elf_machine_sym_no_match.h> Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 02/13] Implement __libc_early_init Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 03/13] nptl: Start new threads with all signals blocked [BZ #25098] Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 04/13] Linux: Add tables with system call numbers Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 05/13] Linux: Use system call tables during build Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 06/13] build-many-glibcs.py: Introduce LinuxHeadersPolicyForBuild Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 07/13] build-many-glibcs.py: Introduce glibc build policy classes Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 08/13] build-many-glibcs.py: Implement update-syscalls command Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 09/13] glibc: Perform rseq(2) registration at C startup and thread creation (v13) Mathieu Desnoyers
2020-01-07 12:23   ` Florian Weimer
2020-01-07 20:44     ` Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 10/13] glibc: sched_getcpu(): use rseq cpu_id TLS on Linux (v5) Mathieu Desnoyers
2020-01-06 15:57 ` [RFC PATCH glibc 11/13] support record failure: allow use from constructor Mathieu Desnoyers
2020-01-06 15:57 ` Mathieu Desnoyers [this message]
2020-01-06 15:57 ` [RFC PATCH glibc 13/13] rseq registration tests (v7) Mathieu Desnoyers
2020-01-07 12:25 ` [RFC PATCH glibc 00/13] Restartable Sequences enablement Florian Weimer
2020-01-07 20:45   ` Mathieu Desnoyers
  -- strict thread matches above, loose matches on Subject: below --
2019-12-20 21:36 Mathieu Desnoyers
2019-12-20 21:36 ` [RFC PATCH glibc 12/13] support: implement xpthread key create/delete (v3) Mathieu Desnoyers
2019-12-21  9:51   ` Florian Weimer
2019-12-21 18:31     ` Mathieu Desnoyers
2019-12-21 18:43       ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200106155713.397-13-mathieu.desnoyers@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=carlos@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=szabolcs.nagy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).