[Libreoffice-commits] core.git: dbaccess/source include/vcl svtools/source svx/source uui/source vcl/source vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 6 13:33:03 UTC 2018
dbaccess/source/ui/browser/sbagrid.cxx | 4 ++--
include/vcl/svapp.hxx | 20 ++++++++++----------
svtools/source/hatchwindow/documentcloser.cxx | 2 +-
svx/source/fmcomp/gridctrl.cxx | 2 +-
uui/source/iahndl.cxx | 16 ++++------------
vcl/source/app/svapp.cxx | 4 ++--
vcl/source/helper/threadex.cxx | 2 +-
vcl/unx/generic/app/saldata.cxx | 2 +-
8 files changed, 22 insertions(+), 30 deletions(-)
New commits:
commit d186ed09bcabe36f70e8a58b4f0b1c05c3c72218
Author: Andras Timar <andras.timar at collabora.com>
AuthorDate: Tue Nov 6 11:28:52 2018 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Nov 6 14:31:44 2018 +0100
replace Application::GetMainThreadIdentifier to Application::IsMainThread
Change-Id: I2b9ea77b48673af3575a3142feea5bed84f75d74
Reviewed-on: https://gerrit.libreoffice.org/62950
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Jenkins
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 01603fa72e8e..041bfc66b550 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -364,7 +364,7 @@ IMPL_LINK_NOARG( SbaXGridPeer, OnDispatchEvent, void*, void )
VclPtr< SbaGridControl > pGrid = GetAs< SbaGridControl >();
if ( pGrid ) // if this fails, we were disposing before arriving here
{
- if ( Application::GetMainThreadIdentifier() != ::osl::Thread::getCurrentIdentifier() )
+ if ( !Application::IsMainThread() )
{
// still not in the main thread (see SbaXGridPeer::dispatch). post an event, again
// without moving the special even to the back of the queue
@@ -400,7 +400,7 @@ void SAL_CALL SbaXGridPeer::dispatch(const URL& aURL, const Sequence< PropertyVa
if (!pGrid)
return;
- if ( Application::GetMainThreadIdentifier() != ::osl::Thread::getCurrentIdentifier() )
+ if ( !Application::IsMainThread() )
{
// we're not in the main thread. This is bad, as we want to raise windows here,
// and VCL does not like windows to be opened in non-main threads (at least on Win32).
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index b1e9eb7c9a45..664f8ba8d56a 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -456,14 +456,14 @@ public:
/** Run the main event processing loop until it is quit by Quit().
@see Quit, Reschedule, Yield, EndYield, GetSolarMutex,
- GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
+ IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
*/
static void Execute();
/** Quit the program
@see Execute, Reschedule, Yield, EndYield, GetSolarMutex,
- GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
+ IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
*/
static void Quit();
@@ -490,14 +490,14 @@ public:
if an event was processed.
@see Execute, Quit, Reschedule, EndYield, GetSolarMutex,
- GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
+ IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
*/
static void Yield();
/**
@see Execute, Quit, Reschedule, Yield, GetSolarMutex,
- GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
+ IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
*/
static void EndYield();
@@ -509,18 +509,18 @@ public:
@returns SolarMutex reference
@see Execute, Quit, Reschedule, Yield, EndYield,
- GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
+ IsMainThread, ReleaseSolarMutex, AcquireSolarMutex,
*/
static comphelper::SolarMutex& GetSolarMutex();
- /** Get the main thread ID.
+ /** Queries whether we are in main thread.
- @returns oslThreadIdentifier that contains the thread ID
+ @returns true if we are in main thread, false if not
@see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
ReleaseSolarMutex, AcquireSolarMutex,
*/
- static oslThreadIdentifier GetMainThreadIdentifier();
+ static bool IsMainThread();
/** @brief Release Solar Mutex(es) for this thread
@@ -530,7 +530,7 @@ public:
@returns The number of mutexes that were acquired by this thread.
@see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
- GetMainThreadIdentifier, AcquireSolarMutex,
+ IsMainThread, AcquireSolarMutex,
*/
static sal_uInt32 ReleaseSolarMutex();
@@ -540,7 +540,7 @@ public:
VCL concurrently.
@see Execute, Quit, Reschedule, Yield, EndYield, GetSolarMutex,
- GetMainThreadIdentifier, ReleaseSolarMutex,
+ IsMainThread, ReleaseSolarMutex,
*/
static void AcquireSolarMutex( sal_uInt32 nCount );
diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx
index 69761b14eddd..ed064b3d4f76 100644
--- a/svtools/source/hatchwindow/documentcloser.cxx
+++ b/svtools/source/hatchwindow/documentcloser.cxx
@@ -85,7 +85,7 @@ void MainThreadFrameCloserRequest::Start( MainThreadFrameCloserRequest* pMTReque
{
if ( pMTRequest )
{
- if ( Application::GetMainThreadIdentifier() == osl::Thread::getCurrentIdentifier() )
+ if ( Application::IsMainThread() )
{
// this is the main thread
worker( nullptr, pMTRequest );
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 29664c00d673..325d2b2957ef 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -3423,7 +3423,7 @@ void DbGridControl::implAdjustInSolarThread(bool _bRows)
{
SAL_INFO("svx.fmcomp", "DbGridControl::implAdjustInSolarThread");
::osl::MutexGuard aGuard(m_aAdjustSafety);
- if (::osl::Thread::getCurrentIdentifier() != Application::GetMainThreadIdentifier())
+ if (!Application::IsMainThread())
{
m_nAsynAdjustEvent = PostUserEvent(LINK(this, DbGridControl, OnAsyncAdjust), reinterpret_cast< void* >( _bRows ), true);
m_bPendingAdjustRows = _bRows;
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 2ec7bb5496a3..6680ea4feae7 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -162,12 +162,8 @@ bool
UUIInteractionHelper::handleRequest(
uno::Reference< task::XInteractionRequest > const & rRequest)
{
- if(
- Application::GetMainThreadIdentifier()
- != osl::Thread::getCurrentIdentifier()
- &&
- GetpApp()
- ) {
+ if(!Application::IsMainThread() && GetpApp())
+ {
// we are not in the main thread, let it handle that stuff
HandleData aHD(rRequest);
Link<void*,void> aLink(&aHD,handlerequest);
@@ -217,12 +213,8 @@ beans::Optional< OUString >
UUIInteractionHelper::getStringFromRequest(
uno::Reference< task::XInteractionRequest > const & rRequest)
{
- if(
- Application::GetMainThreadIdentifier()
- != osl::Thread::getCurrentIdentifier()
- &&
- GetpApp()
- ) {
+ if(!Application::IsMainThread() && GetpApp())
+ {
// we are not in the main thread, let it handle that stuff
HandleData aHD(rRequest);
Link<void*,void> aLink(&aHD,getstringfromrequest);
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 7c1219795d6b..3221804607e3 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -518,9 +518,9 @@ comphelper::SolarMutex& Application::GetSolarMutex()
return *(pSVData->mpDefInst->GetYieldMutex());
}
-oslThreadIdentifier Application::GetMainThreadIdentifier()
+bool Application::IsMainThread()
{
- return ImplGetSVData()->mnMainThreadId;
+ return ImplGetSVData()->mnMainThreadId == osl::Thread::getCurrentIdentifier();
}
sal_uInt32 Application::ReleaseSolarMutex()
diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx
index 6e3f7f4808f8..16249bf44c9a 100644
--- a/vcl/source/helper/threadex.cxx
+++ b/vcl/source/helper/threadex.cxx
@@ -45,7 +45,7 @@ IMPL_LINK_NOARG(SolarThreadExecutor, worker, void*, void)
void SolarThreadExecutor::execute()
{
- if( ::osl::Thread::getCurrentIdentifier() == Application::GetMainThreadIdentifier() )
+ if( Application::IsMainThread() )
{
m_aStart.set();
doIt();
diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
index 8141da534a57..decdaa50177e 100644
--- a/vcl/unx/generic/app/saldata.cxx
+++ b/vcl/unx/generic/app/saldata.cxx
@@ -82,7 +82,7 @@ static int XErrorHdl( Display *pDisplay, XErrorEvent *pEvent )
static int XIOErrorHdl( Display * )
{
- if (::osl::Thread::getCurrentIdentifier() == Application::GetMainThreadIdentifier())
+ if ( Application::IsMainThread() )
{
/* #106197# hack: until a real shutdown procedure exists
* _exit ASAP
More information about the Libreoffice-commits
mailing list