Kaydet (Commit) d186ed09 authored tarafından Andras Timar's avatar Andras Timar

replace Application::GetMainThreadIdentifier to Application::IsMainThread

Change-Id: I2b9ea77b48673af3575a3142feea5bed84f75d74
Reviewed-on: https://gerrit.libreoffice.org/62950Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
üst 4d9dda3f
......@@ -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).
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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);
......
......@@ -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()
......
......@@ -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();
......
......@@ -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
......
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