Update to 2.0.7
FreeBSD specific Mutex code now incorporated upstream, so patches to sphinxstd.cpp, sphinxstd.h no longer required. Not-exactly-a-ChangeLog: http://sphinxsearch.com/blog/2013/01/10/highlighting-some-changes-in-sphinx-2-0-7/ Feature safe: yes
This commit is contained in:
parent
87f6e126a7
commit
2e75b56386
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=315906
@ -6,8 +6,7 @@
|
||||
# See http://www.infracaninophile.co.uk/articles/sphinxse.html
|
||||
|
||||
PORTNAME= sphinxsearch
|
||||
PORTVERSION= 2.0.6
|
||||
PORTREVISION= 1
|
||||
PORTVERSION= 2.0.7
|
||||
CATEGORIES= textproc databases
|
||||
MASTER_SITES= http://sphinxsearch.com/files/
|
||||
DISTNAME= sphinx-${PORTVERSION}-release
|
||||
|
@ -1,4 +1,4 @@
|
||||
SHA256 (sphinx-2.0.6-release.tar.gz) = de943c397efda706661b3a12e12e9f8cc8a03bf6c02c5a6ba967a06384feede2
|
||||
SIZE (sphinx-2.0.6-release.tar.gz) = 1972728
|
||||
SHA256 (sphinx-2.0.7-release.tar.gz) = 668e7bd00ff30596581ef7a7f0a9bc591746f6a259e19e1346350c5efa857ef6
|
||||
SIZE (sphinx-2.0.7-release.tar.gz) = 1983132
|
||||
SHA256 (libstemmer_c.tgz) = 19f1ef2a7ee03246f10dd963bcaa5a401a10b7f85f7488415e309e5dbe9f4cf9
|
||||
SIZE (libstemmer_c.tgz) = 129520
|
||||
|
@ -1,107 +0,0 @@
|
||||
--- ./src/sphinxstd.cpp.orig 2012-11-28 21:23:23.177922214 +0000
|
||||
+++ ./src/sphinxstd.cpp 2012-11-28 21:23:34.961920201 +0000
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
-// $Id: sphinxstd.cpp 3445 2012-10-12 10:45:41Z kevg $
|
||||
+// $Id$
|
||||
//
|
||||
|
||||
//
|
||||
@@ -737,6 +737,24 @@
|
||||
{
|
||||
m_pMutex = NULL;
|
||||
|
||||
+#ifdef __FreeBSD__
|
||||
+ CSphString sError, sWarning;
|
||||
+ if ( !m_pStorage.Alloc ( sizeof(sem_t) + iExtraSize, sError, sWarning ) )
|
||||
+ {
|
||||
+ m_sError.SetSprintf ( "storage.alloc, error='%s', warning='%s'", sError.cstr(), sWarning.cstr() );
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ m_pMutex = (sem_t*) m_pStorage.GetWritePtr ();
|
||||
+ int iRes = sem_init ( m_pMutex, 1, 1 );
|
||||
+ if ( iRes )
|
||||
+ {
|
||||
+ m_sError.SetSprintf ( "sem_init, errno=%d ", iRes );
|
||||
+ m_pMutex = NULL;
|
||||
+ m_pStorage.Reset ();
|
||||
+ return;
|
||||
+ }
|
||||
+#else
|
||||
pthread_mutexattr_t tAttr;
|
||||
int iRes = pthread_mutexattr_init ( &tAttr );
|
||||
if ( iRes )
|
||||
@@ -767,6 +785,7 @@
|
||||
m_pStorage.Reset ();
|
||||
return;
|
||||
}
|
||||
+#endif // __FreeBSD__
|
||||
}
|
||||
#else
|
||||
CSphProcessSharedMutex::CSphProcessSharedMutex ( int )
|
||||
@@ -777,18 +796,28 @@
|
||||
void CSphProcessSharedMutex::Lock () const
|
||||
{
|
||||
#if !USE_WINDOWS
|
||||
+#ifdef __FreeBSD__
|
||||
+ if ( m_pMutex )
|
||||
+ sem_wait ( m_pMutex );
|
||||
+#else
|
||||
if ( m_pMutex )
|
||||
pthread_mutex_lock ( m_pMutex );
|
||||
#endif
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
void CSphProcessSharedMutex::Unlock () const
|
||||
{
|
||||
#if !USE_WINDOWS
|
||||
+#ifdef __FreeBSD__
|
||||
+ if ( m_pMutex )
|
||||
+ sem_post ( m_pMutex );
|
||||
+#else
|
||||
if ( m_pMutex )
|
||||
pthread_mutex_unlock ( m_pMutex );
|
||||
#endif
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -802,6 +831,20 @@
|
||||
if ( !m_pMutex )
|
||||
return false;
|
||||
|
||||
+#ifdef __FreeBSD__
|
||||
+ struct timespec tp;
|
||||
+ clock_gettime ( CLOCK_REALTIME, &tp );
|
||||
+
|
||||
+ tp.tv_nsec += tmSpin * 1000;
|
||||
+ if ( tp.tv_nsec > 1000000 )
|
||||
+ {
|
||||
+ int iDelta = (int)( tp.tv_nsec / 1000000 );
|
||||
+ tp.tv_sec += iDelta * 1000000;
|
||||
+ tp.tv_nsec -= iDelta * 1000000;
|
||||
+ }
|
||||
+
|
||||
+ return ( sem_timedwait ( m_pMutex, &tp )==0 );
|
||||
+#else
|
||||
#if defined(HAVE_PTHREAD_MUTEX_TIMEDLOCK) && defined(HAVE_CLOCK_GETTIME)
|
||||
struct timespec tp;
|
||||
clock_gettime ( CLOCK_REALTIME, &tp );
|
||||
@@ -830,6 +873,7 @@
|
||||
|
||||
return iRes==0;
|
||||
#endif // HAVE_PTHREAD_MUTEX_TIMEDLOCK && HAVE_CLOCK_GETTIME
|
||||
+#endif // __FreeBSD__
|
||||
#endif // USE_WINDOWS
|
||||
}
|
||||
|
||||
@@ -1338,5 +1382,5 @@
|
||||
#endif
|
||||
|
||||
//
|
||||
-// $Id: sphinxstd.cpp 3445 2012-10-12 10:45:41Z kevg $
|
||||
+// $Id$
|
||||
//
|
@ -1,50 +0,0 @@
|
||||
--- ./src/sphinxstd.h.orig 2012-11-28 21:23:17.008920478 +0000
|
||||
+++ ./src/sphinxstd.h 2012-11-28 21:23:38.979912416 +0000
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
-// $Id: sphinxstd.h 3461 2012-10-19 09:48:07Z kevg $
|
||||
+// $Id$
|
||||
//
|
||||
|
||||
//
|
||||
@@ -62,6 +62,9 @@
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
+#ifdef __FreeBSD__
|
||||
+#include <semaphore.h>
|
||||
+#endif
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -2032,7 +2035,11 @@
|
||||
protected:
|
||||
#if !USE_WINDOWS
|
||||
CSphSharedBuffer<BYTE> m_pStorage;
|
||||
+#ifdef __FreeBSD__
|
||||
+ sem_t * m_pMutex;
|
||||
+#else
|
||||
pthread_mutex_t * m_pMutex;
|
||||
+#endif
|
||||
CSphString m_sError;
|
||||
#endif
|
||||
};
|
||||
@@ -2050,7 +2057,11 @@
|
||||
{
|
||||
if ( m_pMutex )
|
||||
{
|
||||
+#ifdef __FreeBSD__
|
||||
+ m_pValue = reinterpret_cast<T*> ( m_pStorage.GetWritePtr () + sizeof ( sem_t ) );
|
||||
+#else
|
||||
m_pValue = reinterpret_cast<T*> ( m_pStorage.GetWritePtr () + sizeof ( pthread_mutex_t ) );
|
||||
+#endif
|
||||
*m_pValue = tInitValue;
|
||||
}
|
||||
}
|
||||
@@ -2478,5 +2489,5 @@
|
||||
#endif // _sphinxstd_
|
||||
|
||||
//
|
||||
-// $Id: sphinxstd.h 3461 2012-10-19 09:48:07Z kevg $
|
||||
+// $Id$
|
||||
//
|
Loading…
Reference in New Issue
Block a user