[Libreoffice-commits] core.git: 2 commits - sal/osl sw/source
Noel Grandin
noel at peralex.com
Fri Jul 11 05:42:04 PDT 2014
sal/osl/unx/mutex.c | 2 +-
sw/source/core/docnode/observablethread.cxx | 16 +---------------
sw/source/core/inc/observablethread.hxx | 13 +++++++------
3 files changed, 9 insertions(+), 22 deletions(-)
New commits:
commit c62e854ee40d427153b9f5d0c1d93b6ee0b13bfa
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jul 11 14:41:02 2014 +0200
convert sw/ObservableThread to salhelper::SimpleReferenceObject
instead of re-implementing it's own reference counting
Change-Id: I2600b970544f1dfd84b987d1891c79e3c377bd1b
diff --git a/sw/source/core/docnode/observablethread.cxx b/sw/source/core/docnode/observablethread.cxx
index ab225eb..2be12d4 100644
--- a/sw/source/core/docnode/observablethread.cxx
+++ b/sw/source/core/docnode/observablethread.cxx
@@ -25,8 +25,7 @@
#i73788#
*/
ObservableThread::ObservableThread()
- : mnRefCount( 0 ),
- mnThreadID( 0 ),
+ : mnThreadID( 0 ),
mpThreadListener()
{
}
@@ -35,19 +34,6 @@ ObservableThread::~ObservableThread()
{
}
-oslInterlockedCount ObservableThread::acquire()
-{
- return osl_atomic_increment( &mnRefCount );
-}
-
-oslInterlockedCount ObservableThread::release()
-{
- oslInterlockedCount nCount( osl_atomic_decrement( &mnRefCount ) );
- if ( nCount == 0 )
- delete this;
- return nCount;
-}
-
void ObservableThread::SetListener( boost::weak_ptr< IFinishedThreadListener > pThreadListener,
const oslInterlockedCount nThreadID )
{
diff --git a/sw/source/core/inc/observablethread.hxx b/sw/source/core/inc/observablethread.hxx
index 4096f3c..13b4527 100644
--- a/sw/source/core/inc/observablethread.hxx
+++ b/sw/source/core/inc/observablethread.hxx
@@ -25,6 +25,7 @@
#include <boost/weak_ptr.hpp>
#include <ithreadlistenerowner.hxx>
+#include <salhelper/simplereferenceobject.hxx>
/** class for an observable thread
@@ -37,7 +38,7 @@
to notify, that the thread has finished its work.
*/
class ObservableThread : public osl::Thread,
- public rtl::IReference
+ public salhelper::SimpleReferenceObject
{
public:
@@ -46,9 +47,11 @@ class ObservableThread : public osl::Thread,
void SetListener( boost::weak_ptr< IFinishedThreadListener > pThreadListener,
const oslInterlockedCount nThreadID );
- // IReference
- virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
- virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
+ static inline void * operator new(std::size_t size)
+ { return SimpleReferenceObject::operator new(size); }
+
+ static inline void operator delete(void * pointer)
+ { SimpleReferenceObject::operator delete(pointer); }
protected:
@@ -79,8 +82,6 @@ class ObservableThread : public osl::Thread,
private:
- oslInterlockedCount mnRefCount;
-
oslInterlockedCount mnThreadID;
boost::weak_ptr< IFinishedThreadListener > mpThreadListener;
commit 0cca713f69710d1312acdde9115b359dd8bfc010
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jul 11 14:40:18 2014 +0200
attempt to fix linux build
on some older boxes, after my commit
dac4ca5 "new loplugin: externalandnotdefined"
Change-Id: Ibcab5f39714fb531066709e91a7322270995a6a5
diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c
index f48e2e2..66a51509 100644
--- a/sal/osl/unx/mutex.c
+++ b/sal/osl/unx/mutex.c
@@ -25,7 +25,7 @@
#include <pthread.h>
#include <stdlib.h>
-#if defined LINUX && !((__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) /* bad hack */
+#if defined LINUX && !((__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 0)) /* bad hack */
int pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int);
#define pthread_mutexattr_settype pthread_mutexattr_setkind_np
#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
More information about the Libreoffice-commits
mailing list