From cd4a521e22d6916f902f11a8a57e35a8fd5aba15 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 19 Apr 2016 20:43:18 -0500 Subject: [PATCH] Fix race condition in socket close --- Socket.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Socket.cpp b/Socket.cpp index aa8a47023c..f2eeb14f1e 100644 --- a/Socket.cpp +++ b/Socket.cpp @@ -53,7 +53,9 @@ int Socket::close() return 0; } - void *socket = _socket; + _iface->socket_attach(_socket, 0, 0); + + void *volatile socket = _socket; _socket = 0; return _iface->socket_close(socket); }