From dd32ad2a56ece2c01139d8b3ea0c1a9ea530e36b Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 10 May 2011 10:01:04 +0000
Subject: [PATCH] bug 1362: prevent cancellation in ~Socket()

---
 LCS/Common/src/Net/Socket.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/LCS/Common/src/Net/Socket.cc b/LCS/Common/src/Net/Socket.cc
index 12ce7fc8240..37010c1c69b 100644
--- a/LCS/Common/src/Net/Socket.cc
+++ b/LCS/Common/src/Net/Socket.cc
@@ -27,6 +27,7 @@
 #include <Common/StringUtil.h>
 #include <Common/hexdump.h>
 #include <Common/Exception.h>
+#include <Common/Thread/Cancellation.h>
 
 #ifndef USE_NOSOCKETS
 
@@ -181,6 +182,8 @@ Socket::Socket (const string&	socketname,
 //
 Socket::~Socket()
 {
+        ScopedDelayCancellation dc; // close is and unlink can be a cancellation point
+
 	LOG_TRACE_OBJ (formatString("~Socket(%d)", itsSocketID));
 
         if (itsSocketID >=0 && close() != SK_OK) {
-- 
GitLab