openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1708477 - in /openoffice/trunk/main/sal/osl/unx: socket.c sockimpl.h
Date Tue, 13 Oct 2015 18:22:31 GMT
Author: damjan
Date: Tue Oct 13 18:22:30 2015
New Revision: 1708477

URL: http://svn.apache.org/viewvc?rev=1708477&view=rev
Log:
#i126586# FreeBSD automation deadlock: osl_closeSocket() doesn't wake up thread stuck in accept().
Generalize the "#if defined(LINUX)" workarounds to the *BSDs.


Modified:
    openoffice/trunk/main/sal/osl/unx/socket.c
    openoffice/trunk/main/sal/osl/unx/sockimpl.h

Modified: openoffice/trunk/main/sal/osl/unx/socket.c
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/osl/unx/socket.c?rev=1708477&r1=1708476&r2=1708477&view=diff
==============================================================================
--- openoffice/trunk/main/sal/osl/unx/socket.c (original)
+++ openoffice/trunk/main/sal/osl/unx/socket.c Tue Oct 13 18:22:30 2015
@@ -490,7 +490,7 @@ oslSocket __osl_createSocketImpl(int Soc
     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( oslSock
 {
 	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->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->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_acceptConnectionO
 	}
 
     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_acceptConnectionO
         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_acceptConnectionO
 	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;
 }
 

Modified: openoffice/trunk/main/sal/osl/unx/sockimpl.h
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sal/osl/unx/sockimpl.h?rev=1708477&r1=1708476&r2=1708477&view=diff
==============================================================================
--- openoffice/trunk/main/sal/osl/unx/sockimpl.h (original)
+++ openoffice/trunk/main/sal/osl/unx/sockimpl.h Tue Oct 13 18:22:30 2015
@@ -33,6 +33,10 @@ extern "C" {
 #endif
 
 typedef void* (*oslCloseCallback) (void*);
+
+#if defined(LINUX) || defined(FREEBSD) || defined(NETBSD)
+#define CLOSESOCKET_DOESNT_WAKE_UP_ACCEPT 1
+#endif
 	
 struct oslSocketImpl {
     int					m_Socket;
@@ -40,7 +44,7 @@ struct oslSocketImpl {
 	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



Mime
View raw message