[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - sal/osl
Damjan Jovanovic
damjan at apache.org
Tue Oct 13 13:08:19 PDT 2015
sal/osl/unx/socket.c | 26 +++++++++++++-------------
sal/osl/unx/sockimpl.h | 8 +++++++-
2 files changed, 20 insertions(+), 14 deletions(-)
New commits:
commit d3600c128fd32804283e6c4d7c55767ae49a2270
Author: Damjan Jovanovic <damjan at apache.org>
Date: Tue Oct 13 18:54:59 2015 +0000
#i126586# don't break on non-Linux non-FreeBSD non-NetBSD *nix systems ...
diff --git a/sal/osl/unx/sockimpl.h b/sal/osl/unx/sockimpl.h
index 8ab86e7..904190f 100644
--- a/sal/osl/unx/sockimpl.h
+++ b/sal/osl/unx/sockimpl.h
@@ -36,6 +36,8 @@ typedef void* (*oslCloseCallback) (void*);
#if defined(LINUX) || defined(FREEBSD) || defined(NETBSD)
#define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 1
+#else
+#define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 0
#endif
struct oslSocketImpl {
commit 4c7bfe32168912844a50059b2a901f6434c0f86f
Author: Damjan Jovanovic <damjan at apache.org>
Date: Tue Oct 13 18:22:30 2015 +0000
#i126586# FreeBSD automation deadlock: osl_closeSocket() doesn't wake up thread stuck in accept().
Generalize the "#if defined(LINUX)" workarounds to the *BSDs.
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index a55d759..9bd877a 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -490,7 +490,7 @@ oslSocket __osl_createSocketImpl(int Socket)
pSocket->m_CallbackArg = 0;
pSocket->m_nRefCount = 1;
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
pSocket->m_bIsAccepting = sal_False;
#endif
@@ -1824,13 +1824,13 @@ void SAL_CALL osl_releaseSocket( oslSocket pSocket )
{
if( pSocket && 0 == osl_decrementInterlockedCount( &(pSocket->m_nRefCount) ) )
{
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
if ( pSocket->m_bIsAccepting == sal_True )
{
OSL_ENSURE(0, "osl_destroySocket : attempt to destroy socket while accepting\n");
return;
}
-#endif /* LINUX */
+#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
osl_closeSocket( pSocket );
__osl_destroySocketImpl( pSocket );
}
@@ -1858,7 +1858,7 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
pSocket->m_Socket = OSL_INVALID_SOCKET;
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
pSocket->m_bIsInShutdown = sal_True;
if ( pSocket->m_bIsAccepting == sal_True )
@@ -1904,7 +1904,7 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
}
pSocket->m_bIsAccepting = sal_False;
}
-#endif /* LINUX */
+#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
/* registrierten Callback ausfuehren */
if (pSocket->m_CloseCallback != NULL)
@@ -2185,9 +2185,9 @@ oslSocket SAL_CALL osl_acceptConnectionOnSocket(oslSocket pSocket,
}
pSocket->m_nLastError=0;
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
pSocket->m_bIsAccepting = sal_True;
-#endif /* LINUX */
+#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
if( ppAddr && *ppAddr )
{
@@ -2208,23 +2208,23 @@ oslSocket SAL_CALL osl_acceptConnectionOnSocket(oslSocket pSocket,
pSocket->m_nLastError=errno;
OSL_TRACE("osl_acceptConnectionOnSocket : accept error '%s'\n",strerror(errno));
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
pSocket->m_bIsAccepting = sal_False;
-#endif /* LINUX */
+#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
return 0;
}
OSL_ASSERT(AddrLen == sizeof(struct sockaddr));
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
if ( pSocket->m_bIsInShutdown == sal_True )
{
close(Connection);
OSL_TRACE("osl_acceptConnectionOnSocket : close while accept\n");
return 0;
}
-#endif /* LINUX */
+#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
if(ppAddr)
@@ -2253,11 +2253,11 @@ oslSocket SAL_CALL osl_acceptConnectionOnSocket(oslSocket pSocket,
pConnectionSockImpl->m_nLastError = 0;
pConnectionSockImpl->m_CloseCallback = NULL;
pConnectionSockImpl->m_CallbackArg = NULL;
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
pConnectionSockImpl->m_bIsAccepting = sal_False;
pSocket->m_bIsAccepting = sal_False;
-#endif /* LINUX */
+#endif /* CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT */
return pConnectionSockImpl;
}
diff --git a/sal/osl/unx/sockimpl.h b/sal/osl/unx/sockimpl.h
index f148b9d..8ab86e7 100644
--- a/sal/osl/unx/sockimpl.h
+++ b/sal/osl/unx/sockimpl.h
@@ -34,13 +34,17 @@ extern "C" {
typedef void* (*oslCloseCallback) (void*);
+#if defined(LINUX) || defined(FREEBSD) || defined(NETBSD)
+#define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 1
+#endif
+
struct oslSocketImpl {
int m_Socket;
int m_nLastError;
oslCloseCallback m_CloseCallback;
void* m_CallbackArg;
oslInterlockedCount m_nRefCount;
-#if defined(LINUX)
+#if CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT
sal_Bool m_bIsAccepting;
sal_Bool m_bIsInShutdown;
#endif
More information about the Libreoffice-commits
mailing list