[sysprof: 59/63] collector: disable re-entrancy during initialization
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof: 59/63] collector: disable re-entrancy during initialization
- Date: Sat, 4 Jul 2020 18:34:18 +0000 (UTC)
commit 5d20c3f6cfe9014ecc01100d423a4473d8143276
Author: Christian Hergert <chergert redhat com>
Date: Thu Jul 2 15:19:16 2020 -0700
collector: disable re-entrancy during initialization
When creating a new collector, we need to prevent the following
call to sysprof_malloc0() from re-entering us into the same
position.
src/libsysprof-capture/sysprof-collector.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/src/libsysprof-capture/sysprof-collector.c b/src/libsysprof-capture/sysprof-collector.c
index 1d0c57b..b99cd1b 100644
--- a/src/libsysprof-capture/sysprof-collector.c
+++ b/src/libsysprof-capture/sysprof-collector.c
@@ -410,6 +410,12 @@ sysprof_collector_get (void)
{
SysprofCollector *self, *old_collector;
+ /* First set the collector to invalid so anything recursive
+ * here fails instead of becoming re-entrant.
+ */
+ pthread_setspecific (collector_key, COLLECTOR_INVALID);
+
+ /* Now we can malloc without ending up here again */
self = sysprof_malloc0 (sizeof (SysprofCollector));
if (self == NULL)
return COLLECTOR_INVALID;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]