Kaydet (Commit) ad28ffaa authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Remove unnecessary vcl::SolarMutexObject

Change-Id: I6dfdd7d5d211b66019dfbe364101140e28a3584d
üst 36be3d94
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_VCL_SOLARMUTEX_HXX
#define INCLUDED_VCL_SOLARMUTEX_HXX
#include <comphelper/solarmutex.hxx>
#include <osl/mutex.h>
#include <vcl/dllapi.h>
namespace vcl
{
/** Implementation of the SolarMutex interface.
*/
class VCL_DLLPUBLIC SolarMutexObject : public comphelper::SolarMutex
{
public:
//static SolarMutex& SAL_CALL getGlobalMutex();
/** Creates mutex
*/
SolarMutexObject();
/** Implicitly destroys mutex
*/
virtual ~SolarMutexObject();
virtual void acquire();
virtual void release();
virtual bool tryToAcquire();
protected:
oslMutex m_solarMutex;
private:
/* Disable copy/assignment
*/
SolarMutexObject( const SolarMutexObject& );
SolarMutexObject& SAL_CALL operator=( const SolarMutexObject& );
};
}
#endif // INCLUDED_VCL_SOLARMUTEX_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -113,7 +113,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/app/IconThemeInfo \
vcl/source/app/IconThemeScanner \
vcl/source/app/IconThemeSelector \
vcl/source/app/solarmutex \
vcl/source/app/sound \
vcl/source/app/stdtext \
vcl/source/app/svapp \
......
......@@ -46,7 +46,7 @@ SalYieldMutex::~SalYieldMutex()
void SalYieldMutex::acquire()
{
SolarMutexObject::acquire();
m_mutex.acquire();
mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++;
}
......@@ -60,12 +60,12 @@ void SalYieldMutex::release()
mnThreadId = 0;
mnCount--;
}
SolarMutexObject::release();
m_mutex.release();
}
bool SalYieldMutex::tryToAcquire()
{
if ( SolarMutexObject::tryToAcquire() )
if ( m_mutex.tryToAcquire() )
{
mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++;
......
......@@ -42,7 +42,6 @@
#include <svdata.hxx>
#include <generic/gendata.hxx>
#include <basebmp/scanlineformats.hxx>
#include <vcl/solarmutex.hxx>
// FIXME: remove when we re-work the svp mainloop
#include <unx/salunxtime.h>
......
......@@ -20,10 +20,10 @@
#ifndef INCLUDED_VCL_INC_GENERIC_GENINST_H
#define INCLUDED_VCL_INC_GENERIC_GENINST_H
#include <comphelper/solarmutex.hxx>
#include <tools/solar.h>
#include <osl/thread.hxx>
#include <vclpluginapi.h>
#include <vcl/solarmutex.hxx>
#include <salinst.hxx>
#include <saldatabasic.hxx>
#include <generic/genprn.h>
......@@ -46,8 +46,10 @@ inline SalYieldMutexReleaser::~SalYieldMutexReleaser()
GetSalData()->m_pInstance->AcquireYieldMutex( m_nYieldCount );
}
class VCL_DLLPUBLIC SalYieldMutex : public vcl::SolarMutexObject
class VCL_DLLPUBLIC SalYieldMutex : public comphelper::SolarMutex
{
osl::Mutex m_mutex;
protected:
sal_uIntPtr mnCount;
oslThreadIdentifier mnThreadId;
......@@ -60,7 +62,7 @@ public:
virtual void release();
virtual bool tryToAcquire();
virtual sal_uIntPtr GetAcquireCount() const { return mnCount; }
sal_uIntPtr GetAcquireCount() const { return mnCount; }
oslThreadIdentifier GetThreadId() const { return mnThreadId; }
};
......
......@@ -20,8 +20,6 @@
#ifndef INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
#define INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
#include <vcl/solarmutex.hxx>
#include <osl/mutex.hxx>
#include <osl/thread.hxx>
#include <salinst.hxx>
......
......@@ -23,7 +23,6 @@
#include "comphelper/solarmutex.hxx"
#include "osl/thread.hxx"
#include "osl/conditn.h"
#include <vcl/solarmutex.hxx>
#ifdef MACOSX
#include "osx/osxvcltypes.h"
......@@ -37,8 +36,9 @@ class AquaSalFrame;
class ApplicationEvent;
class Image;
class SalYieldMutex : public vcl::SolarMutexObject
class SalYieldMutex : public comphelper::SolarMutex
{
osl::Mutex m_mutex;
sal_uLong mnCount;
oslThreadIdentifier mnThreadId;
......
......@@ -23,7 +23,6 @@
#include <osl/thread.hxx>
#include <vclpluginapi.h>
#include <salinst.hxx>
#include <vcl/solarmutex.hxx>
#include "generic/geninst.h"
#include <prex.h>
......
......@@ -30,7 +30,6 @@
#include "vcl/svapp.hxx"
#include "vcl/window.hxx"
#include "vcl/timer.hxx"
#include "vcl/solarmutex.hxx"
#include "osx/saldata.hxx"
#include "osx/salinst.h"
......@@ -278,7 +277,7 @@ SalYieldMutex::SalYieldMutex()
void SalYieldMutex::acquire()
{
SolarMutexObject::acquire();
m_mutex.acquire();
mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++;
}
......@@ -291,12 +290,12 @@ void SalYieldMutex::release()
mnThreadId = 0;
mnCount--;
}
SolarMutexObject::release();
m_mutex.release();
}
bool SalYieldMutex::tryToAcquire()
{
if ( SolarMutexObject::tryToAcquire() )
if ( m_mutex.tryToAcquire() )
{
mnThreadId = osl::Thread::getCurrentIdentifier();
mnCount++;
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <vcl/solarmutex.hxx>
using namespace vcl;
SolarMutexObject::SolarMutexObject() : m_solarMutex( osl_createMutex() )
{
}
SolarMutexObject::~SolarMutexObject()
{
osl_destroyMutex( m_solarMutex );
}
void SolarMutexObject::acquire()
{
osl_acquireMutex( m_solarMutex );
}
bool SolarMutexObject::tryToAcquire()
{
return osl_tryToAcquireMutex( m_solarMutex );
}
void SolarMutexObject::release()
{
osl_releaseMutex( m_solarMutex );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -30,7 +30,6 @@
#include <vcl/timer.hxx>
#include <vcl/apptypes.hxx>
#include <vcl/solarmutex.hxx>
#include <win/wincomp.hxx>
#include <win/salids.hrc>
#include <win/saldata.hxx>
......@@ -110,8 +109,10 @@ LRESULT CALLBACK SalComWndProcW( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPa
class SalYieldMutex : public vcl::SolarMutexObject
class SalYieldMutex : public comphelper::SolarMutex
{
osl::Mutex m_mutex;
public: // for ImplSalYield()
WinSalInstance* mpInstData;
sal_uLong mnCount;
......@@ -140,7 +141,7 @@ SalYieldMutex::SalYieldMutex( WinSalInstance* pInstData )
void SalYieldMutex::acquire()
{
SolarMutexObject::acquire();
m_mutex.acquire();
mnCount++;
mnThreadId = GetCurrentThreadId();
}
......@@ -151,7 +152,7 @@ void SalYieldMutex::release()
{
DWORD nThreadId = GetCurrentThreadId();
if ( mnThreadId != nThreadId )
SolarMutexObject::release();
m_mutex.release();
else
{
SalData* pSalData = GetSalData();
......@@ -168,13 +169,13 @@ void SalYieldMutex::release()
ImplPostMessage( mpInstData->mhComWnd, SAL_MSG_RELEASEWAITYIELD, 0, 0 );
mnThreadId = 0;
mnCount--;
SolarMutexObject::release();
m_mutex.release();
mpInstData->mpSalWaitMutex->release();
}
else
{
mnCount--;
SolarMutexObject::release();
m_mutex.release();
}
}
else
......@@ -182,7 +183,7 @@ void SalYieldMutex::release()
if ( mnCount == 1 )
mnThreadId = 0;
mnCount--;
SolarMutexObject::release();
m_mutex.release();
}
}
}
......@@ -191,7 +192,7 @@ void SalYieldMutex::release()
bool SalYieldMutex::tryToAcquire()
{
if( SolarMutexObject::tryToAcquire() )
if( m_mutex.tryToAcquire() )
{
mnCount++;
mnThreadId = GetCurrentThreadId();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment