forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path0004-Reduce-lock-lifetime-in-TCollection-GarbageCollect.patch
More file actions
43 lines (38 loc) · 1.24 KB
/
0004-Reduce-lock-lifetime-in-TCollection-GarbageCollect.patch
File metadata and controls
43 lines (38 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 2563f5f047c24201257be3077b1ccaab6117a166 Mon Sep 17 00:00:00 2001
From: Philippe Canal <pcanal@fnal.gov>
Date: Fri, 18 Oct 2013 05:21:16 -0500
Subject: [PATCH] Reduce lock lifetime in TCollection::GarbageCollect
This avoid the potential for unnecessary nested locks
when/if the routine actually deletes the object.
---
core/cont/src/TCollection.cxx | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/core/cont/src/TCollection.cxx b/core/cont/src/TCollection.cxx
index c632446..8fe4b74 100644
--- a/core/cont/src/TCollection.cxx
+++ b/core/cont/src/TCollection.cxx
@@ -581,14 +581,16 @@ void TCollection::GarbageCollect(TObject *obj)
{
// Add to the list of things to be cleaned up.
- R__LOCKGUARD2(gCollectionMutex);
- if (fgGarbageCollection) {
- if (!fgEmptyingGarbage) {
- fgGarbageCollection->Add(obj);
- } else
- delete obj;
- } else
- delete obj;
+ {
+ R__LOCKGUARD2(gCollectionMutex);
+ if (fgGarbageCollection) {
+ if (!fgEmptyingGarbage) {
+ fgGarbageCollection->Add(obj);
+ return;
+ }
+ }
+ }
+ delete obj;
}
//______________________________________________________________________________
--
1.7.4.1