osl_getThreadIdentifier(0) -> osl::Thread::getCurrentIdentifier()

Change-Id: Ida9785c4b9fda0459769957734952e69d7a9de44
This commit is contained in:
Stephan Bergmann
2013-08-21 14:18:40 +02:00
parent bcce27d283
commit 19277d02fb
18 changed files with 53 additions and 39 deletions

View File

@@ -22,6 +22,7 @@
#include "mozillasrc/MQuery.hxx"
#include <osl/mutex.hxx>
#include <osl/conditn.hxx>
#include <osl/thread.hxx>
#include "pre_include_mozilla.h"
#include <nsIProxyObjectManager.h>
@@ -64,7 +65,7 @@ MNSRunnable::MNSRunnable()
NS_INIT_ISUPPORTS();
_ProxiedObject=NULL;
#if OSL_DEBUG_LEVEL > 0
m_oThreadID = osl_getThreadIdentifier(NULL);
m_oThreadID = osl::Thread::getCurrentIdentifier();
#endif
AddRef();
}

View File

@@ -24,6 +24,7 @@
#include "MQuery.hxx"
#include <osl/mutex.hxx>
#include <osl/conditn.hxx>
#include <osl/thread.hxx>
#include "pre_include_mozilla.h"
#include <nsIProxyObjectManager.h>
@@ -60,7 +61,7 @@ MNSMozabProxy::MNSMozabProxy()
{
m_Args = NULL;
#if OSL_DEBUG_LEVEL > 0
m_oThreadID = osl_getThreadIdentifier(NULL);
m_oThreadID = osl::Thread::getCurrentIdentifier();
#endif
acquire();
}

View File

@@ -29,6 +29,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
#include <osl/thread.hxx>
#if OSL_DEBUG_LEVEL > 0
# define OUtoCStr( x ) ( OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr())
@@ -73,7 +74,7 @@ MQuery::MQuery( const OColumnAlias& _ca )
construct();
#if OSL_DEBUG_LEVEL > 0
m_oThreadID = osl_getThreadIdentifier(NULL);
m_oThreadID = osl::Thread::getCurrentIdentifier();
#endif
OSL_TRACE( "\tOUT MQuery::MQuery( ca )" );

View File

@@ -25,6 +25,7 @@
#include "MLdapAttributeMap.hxx"
#include <connectivity/dbexception.hxx>
#include <osl/thread.hxx>
#include "resource/mozab_res.hrc"
@@ -95,7 +96,7 @@ MQueryHelper::MQueryHelper()
{
m_aResults.clear();
#if OSL_DEBUG_LEVEL > 0
m_oThreadID = osl_getThreadIdentifier(NULL);
m_oThreadID = osl::Thread::getCurrentIdentifier();
#endif
}

View File

@@ -145,7 +145,7 @@ AffineBridge::~AffineBridge(void)
{
LOG_LIFECYCLE_AffineBridge_emit(fprintf(stderr, "LIFE: %s -> %p\n", "AffineBridge::~AffineBridge(void)", this));
if (m_pInnerThread && osl_getThreadIdentifier(NULL) != m_innerThreadId)
if (m_pInnerThread && osl::Thread::getCurrentIdentifier() != m_innerThreadId)
{
m_message = CB_DONE;
m_innerCondition.set();
@@ -165,7 +165,7 @@ AffineBridge::~AffineBridge(void)
void AffineBridge::outerDispatch(int loop)
{
OSL_ASSERT(m_outerThreadId == osl_getThreadIdentifier(NULL));
OSL_ASSERT(m_outerThreadId == osl::Thread::getCurrentIdentifier());
OSL_ASSERT(m_innerThreadId != m_outerThreadId);
Msg mm;
@@ -204,7 +204,7 @@ void AffineBridge::outerDispatch(int loop)
void AffineBridge::innerDispatch(void)
{
OSL_ASSERT(m_innerThreadId == osl_getThreadIdentifier(NULL));
OSL_ASSERT(m_innerThreadId == osl::Thread::getCurrentIdentifier());
OSL_ASSERT(m_innerThreadId != m_outerThreadId);
Msg mm;
@@ -249,7 +249,7 @@ void AffineBridge::v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam)
bool resetId = false;
if (!m_outerThreadId)
{
m_outerThreadId = osl_getThreadIdentifier(NULL);
m_outerThreadId = osl::Thread::getCurrentIdentifier();
resetId = true;
}
@@ -299,16 +299,16 @@ void AffineBridge::v_enter(void)
m_innerMutex.acquire();
if (!m_enterCount)
m_innerThreadId = osl_getThreadIdentifier(NULL);
m_innerThreadId = osl::Thread::getCurrentIdentifier();
OSL_ASSERT(m_innerThreadId == osl_getThreadIdentifier(NULL));
OSL_ASSERT(m_innerThreadId == osl::Thread::getCurrentIdentifier());
++ m_enterCount;
}
void AffineBridge::v_leave(void)
{
OSL_ASSERT(m_innerThreadId == osl_getThreadIdentifier(NULL));
OSL_ASSERT(m_innerThreadId == osl::Thread::getCurrentIdentifier());
-- m_enterCount;
if (!m_enterCount)
@@ -325,7 +325,7 @@ int AffineBridge::v_isValid(rtl::OUString * pReason)
else
{
result = m_innerThreadId == osl_getThreadIdentifier(NULL);
result = m_innerThreadId == osl::Thread::getCurrentIdentifier();
if (!result)
*pReason = rtl::OUString("wrong thread");

View File

@@ -20,6 +20,7 @@
#include "osl/mutex.hxx"
#include "osl/thread.h"
#include "osl/thread.hxx"
#include "uno/dispatcher.h"
#include "typelib/typedescription.hxx"
#include "cppu/helper/purpenv/Environment.hxx"
@@ -79,7 +80,7 @@ void LogBridge::v_callOut_v(uno_EnvCallee * pCallee, va_list * pParam)
++ m_count;
if (!m_threadId)
m_threadId = osl_getThreadIdentifier(NULL);
m_threadId = osl::Thread::getCurrentIdentifier();
}
void LogBridge::v_enter(void)
@@ -89,7 +90,7 @@ void LogBridge::v_enter(void)
OSL_ASSERT(m_count >= 0);
if (m_count == 0)
m_threadId = osl_getThreadIdentifier(NULL);
m_threadId = osl::Thread::getCurrentIdentifier();
++ m_count;
}
@@ -115,7 +116,7 @@ int LogBridge::v_isValid(rtl::OUString * pReason)
}
else
{
result = m_threadId == osl_getThreadIdentifier(NULL);
result = m_threadId == osl::Thread::getCurrentIdentifier();
if (!result)
*pReason = rtl::OUString("wrong thread");

View File

@@ -20,6 +20,7 @@
#include "osl/mutex.hxx"
#include "osl/thread.h"
#include "osl/thread.hxx"
#include "cppu/helper/purpenv/Environment.hxx"
#include "cppu/helper/purpenv/Mapping.hxx"
@@ -89,7 +90,7 @@ void UnsafeBridge::v_callOut_v(uno_EnvCallee * pCallee, va_list * pParam)
++ m_count;
if (!m_threadId)
m_threadId = osl_getThreadIdentifier(NULL);
m_threadId = osl::Thread::getCurrentIdentifier();
}
void UnsafeBridge::v_enter(void)
@@ -99,7 +100,7 @@ void UnsafeBridge::v_enter(void)
OSL_ASSERT(m_count >= 0);
if (m_count == 0)
m_threadId = osl_getThreadIdentifier(NULL);
m_threadId = osl::Thread::getCurrentIdentifier();
++ m_count;
}
@@ -125,7 +126,7 @@ int UnsafeBridge::v_isValid(rtl::OUString * pReason)
}
else
{
result = m_threadId == osl_getThreadIdentifier(NULL);
result = m_threadId == osl::Thread::getCurrentIdentifier();
if (!result)
*pReason = rtl::OUString("wrong thread");

View File

@@ -22,7 +22,7 @@
#include <list>
#include <osl/mutex.hxx>
#include <osl/thread.h>
#include <osl/thread.hxx>
#include <osl/diagnose.h>
#include <rtl/process.h>
@@ -42,7 +42,7 @@ using namespace ::cppu;
static inline void createLocalId( sal_Sequence **ppThreadId )
{
rtl_byte_sequence_constructNoDefault( ppThreadId , 4 + 16 );
sal_uInt32 id = osl_getThreadIdentifier(0);
sal_uInt32 id = osl::Thread::getCurrentIdentifier();
(*ppThreadId)->elements[0] = id & 0xFF;
(*ppThreadId)->elements[1] = (id >> 8) & 0xFF;
(*ppThreadId)->elements[2] = (id >> 16) & 0xFF;

View File

@@ -25,6 +25,7 @@
#include "rtl/instance.hxx"
#include "osl/thread.h"
#include "osl/thread.hxx"
#include "osl/mutex.hxx"
#include <boost/unordered_map.hpp>
@@ -69,7 +70,7 @@ namespace
static void s_setCurrent(uno_Environment * pEnv)
{
oslThreadIdentifier threadId = osl_getThreadIdentifier(NULL);
oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
osl::MutexGuard guard(s_threadMap_mutex::get());
ThreadMap &rThreadMap = s_threadMap::get();
@@ -89,7 +90,7 @@ static uno_Environment * s_getCurrent(void)
{
uno_Environment * pEnv = NULL;
oslThreadIdentifier threadId = osl_getThreadIdentifier(NULL);
oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
osl::MutexGuard guard(s_threadMap_mutex::get());
ThreadMap &rThreadMap = s_threadMap::get();

View File

@@ -41,7 +41,7 @@
#include <comphelper/storagehelper.hxx>
#include <comphelper/mimeconfighelper.hxx>
#include <comphelper/classids.hxx>
#include <osl/thread.hxx>
#include <olecomponent.hxx>
#include <closepreventer.hxx>
@@ -212,7 +212,7 @@ void VerbExecutionController::StartControlExecution()
if ( !m_bVerbExecutionInProgress && !m_bWasEverActive )
{
m_bVerbExecutionInProgress = sal_True;
m_nVerbExecutionThreadIdentifier = osl_getThreadIdentifier( NULL );
m_nVerbExecutionThreadIdentifier = osl::Thread::getCurrentIdentifier();
m_bChangedOnVerbExecution = sal_False;
}
}
@@ -223,7 +223,7 @@ sal_Bool VerbExecutionController::EndControlExecution_WasModified()
osl::MutexGuard aGuard( m_aVerbExecutionMutex );
sal_Bool bResult = sal_False;
if ( m_bVerbExecutionInProgress && m_nVerbExecutionThreadIdentifier == osl_getThreadIdentifier( NULL ) )
if ( m_bVerbExecutionInProgress && m_nVerbExecutionThreadIdentifier == osl::Thread::getCurrentIdentifier() )
{
bResult = m_bChangedOnVerbExecution;
m_bVerbExecutionInProgress = sal_False;
@@ -237,7 +237,7 @@ void VerbExecutionController::ModificationNotificationIsDone()
{
osl::MutexGuard aGuard( m_aVerbExecutionMutex );
if ( m_bVerbExecutionInProgress && osl_getThreadIdentifier( NULL ) == m_nVerbExecutionThreadIdentifier )
if ( m_bVerbExecutionInProgress && osl::Thread::getCurrentIdentifier() == m_nVerbExecutionThreadIdentifier )
m_bChangedOnVerbExecution = sal_True;
}
#endif

View File

@@ -21,6 +21,7 @@
#include <osl/time.h>
#include <osl/thread.h>
#include <osl/thread.hxx>
#include <osl/diagnose.h>
//........................................................................
@@ -45,7 +46,7 @@ namespace logging
*/
OUString getCurrentThreadID()
{
oslThreadIdentifier nThreadID( osl_getThreadIdentifier( NULL ) );
oslThreadIdentifier nThreadID( osl::Thread::getCurrentIdentifier() );
return OUString::valueOf( (sal_Int64)nThreadID );
}
}

View File

@@ -47,6 +47,7 @@
#if OSL_DEBUG_LEVEL > 1
#include <osl/thread.h>
#include <osl/thread.hxx>
#include <stdio.h>
static FILE * s_file = 0;
void TRACE( char const * s )
@@ -55,7 +56,7 @@ void TRACE( char const * s )
s_file = stderr;
if (s_file)
{
oslThreadIdentifier t = osl_getThreadIdentifier(0);
oslThreadIdentifier t = osl::Thread::getCurrentIdentifier();
fprintf( s_file, "log [t_id=%" SAL_PRIuUINT32 "]: %s\n", t, s );
fflush( s_file );
}
@@ -66,7 +67,7 @@ void TRACEN( char const * s, long n )
s_file = stderr;
if (s_file)
{
oslThreadIdentifier t = osl_getThreadIdentifier(0);
oslThreadIdentifier t = osl::Thread::getCurrentIdentifier();
fprintf( s_file, "log [t_id=%" SAL_PRIuUINT32 "]: %s%ld\n", t, s, n );
fflush( s_file );
}
@@ -77,7 +78,7 @@ void TRACES( char const* s, char const* s2 )
s_file = stderr;
if (s_file)
{
oslThreadIdentifier t = osl_getThreadIdentifier(0);
oslThreadIdentifier t = osl::Thread::getCurrentIdentifier();
fprintf( s_file, "log [t_id=%" SAL_PRIuUINT32 "]: %s %s\n", t, s, s2 );
fflush( s_file );
}

View File

@@ -54,7 +54,7 @@
*
************************************************************************/
#include "lwpglobalmgr.hxx"
#include <osl/thread.h>
#include <osl/thread.hxx>
std::map< sal_uInt32,LwpGlobalMgr* > LwpGlobalMgr::m_ThreadMap;
LwpGlobalMgr::LwpGlobalMgr(LwpSvStream* pSvStream)
{
@@ -106,7 +106,7 @@ LwpGlobalMgr::~LwpGlobalMgr()
LwpGlobalMgr* LwpGlobalMgr::GetInstance(LwpSvStream* pSvStream)
{
sal_uInt32 nThreadID = osl_getThreadIdentifier((void*)0);
sal_uInt32 nThreadID = osl::Thread::getCurrentIdentifier();
std::map< sal_uInt32,LwpGlobalMgr* >::iterator iter;
iter = m_ThreadMap.find(nThreadID);
if (iter == m_ThreadMap.end())
@@ -121,7 +121,7 @@ LwpGlobalMgr* LwpGlobalMgr::GetInstance(LwpSvStream* pSvStream)
void LwpGlobalMgr::DeleteInstance()
{
sal_uInt32 nThreadID = osl_getThreadIdentifier((void*)0);
sal_uInt32 nThreadID = osl::Thread::getCurrentIdentifier();
std::map< sal_uInt32,LwpGlobalMgr* >::iterator iter;
iter = m_ThreadMap.find(nThreadID);
if (iter != m_ThreadMap.end())

View File

@@ -21,6 +21,7 @@
#include <time.h>
#include <osl/thread.h>
#include <osl/thread.hxx>
#include <typelib/typedescription.hxx>
@@ -153,7 +154,7 @@ void log( RuntimeCargo * cargo, sal_Int32 level, const char *str )
localDateTime.NanoSeconds/1000000),
strLevel[level],
sal::static_int_cast< long >(
(sal_Int32) osl_getThreadIdentifier( 0)),
(sal_Int32) osl::Thread::getCurrentIdentifier()),
str );
}
}

View File

@@ -33,6 +33,7 @@
#include <rtl/instance.hxx>
#include <sal/log.hxx>
#include "osl/thread.h"
#include "osl/thread.hxx"
#include <algorithm>
@@ -207,7 +208,7 @@ extern "C" void SAL_CALL rtl_logfile_longTrace(char const * format, ...) {
init();
if (g_buffer != 0) {
sal_uInt32 time = osl_getGlobalTimer();
oslThreadIdentifier threadId = osl_getThreadIdentifier(0);
oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier();
va_list args;
va_start(args, format);
{

View File

@@ -19,6 +19,7 @@
#include <sal/types.h>
#include <osl/thread.h>
#include <osl/thread.hxx>
#include <osl/time.h>
#include <rtl/alloc.h>
#include <rtl/digest.h>
@@ -128,7 +129,7 @@ static sal_Bool __rtl_random_initPool (RandomPool_Impl *pImpl)
__rtl_random_seedPool (pImpl, (sal_uInt8*)&rd, sizeof(rd));
*/
id = osl_getThreadIdentifier (NULL);
id = osl::Thread::getCurrentIdentifier();
id = RTL_RANDOM_RNG_2(RTL_RANDOM_RNG_1(id));
__rtl_random_seedPool (pImpl, (sal_uInt8*)&id, sizeof(id));

View File

@@ -25,6 +25,7 @@
#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <comphelper/processfactory.hxx>
#include <osl/mutex.hxx>
#include <osl/thread.hxx>
#include <vcl/svapp.hxx>
#include <vcl/dialog.hxx>
#include <tools/link.hxx>
@@ -58,7 +59,7 @@ void MainThreadFrameCloserRequest::Start( MainThreadFrameCloserRequest* pMTReque
{
if ( pMTRequest )
{
if ( Application::GetMainThreadIdentifier() == osl_getThreadIdentifier( NULL ) )
if ( Application::GetMainThreadIdentifier() == osl::Thread::getCurrentIdentifier() )
{
// this is the main thread
worker( NULL, pMTRequest );

View File

@@ -65,6 +65,7 @@
#include "tools/rcid.h" // RSC_STRING
#include "tools/errinf.hxx" // ErrorHandler, ErrorContext, ...
#include "osl/mutex.hxx"
#include "osl/thread.hxx"
#include "tools/diagnose_ex.h"
#include "comphelper/documentconstants.hxx" // ODFVER_012_TEXT
#include "svtools/sfxecode.hxx" // ERRCODE_SFX_*
@@ -175,7 +176,7 @@ UUIInteractionHelper::handleRequest(
// be aware,it is the same type
static_cast< oslThreadIdentifier >(
Application::GetMainThreadIdentifier())
!= osl_getThreadIdentifier(NULL)
!= osl::Thread::getCurrentIdentifier()
&&
(pApp = GetpApp())
!= 0
@@ -236,7 +237,7 @@ UUIInteractionHelper::getStringFromRequest(
// be aware,it is the same type
static_cast< oslThreadIdentifier >(
Application::GetMainThreadIdentifier())
!= osl_getThreadIdentifier(NULL)
!= osl::Thread::getCurrentIdentifier()
&&
(pApp = GetpApp())
!= 0