diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-10-01 08:37:21 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-10-01 10:20:18 +0200 |
commit | 585ac6e4dd49d8cb52e575a0ba1aaec9b58aa835 (patch) | |
tree | 12f0aad3adb226fb278d6a8a6ab6b675a820fe01 /sal | |
parent | fc04f76336fdf8c96e35382cdeb497e2f939705c (diff) |
sal/osl/unx/thread.c -> .cxx
Change-Id: I6cb46a51dda3fda51a3b6413656da15fc5bdb04d
Diffstat (limited to 'sal')
-rw-r--r-- | sal/Library_sal.mk | 2 | ||||
-rw-r--r-- | sal/osl/unx/thread.cxx (renamed from sal/osl/unx/thread.c) | 25 |
2 files changed, 13 insertions, 14 deletions
diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk index e5c02c2764c9..12f5551ee7ce 100644 --- a/sal/Library_sal.mk +++ b/sal/Library_sal.mk @@ -167,6 +167,7 @@ $(eval $(call gb_Library_add_exception_objects,sal,\ sal/osl/unx/profile \ sal/osl/unx/security \ sal/osl/unx/tempfile \ + sal/osl/unx/thread \ $(if $(filter DESKTOP,$(BUILD_TYPE)), sal/osl/unx/salinit) \ )) $(eval $(call gb_Library_add_cobjects,sal,\ @@ -177,7 +178,6 @@ $(eval $(call gb_Library_add_cobjects,sal,\ sal/osl/unx/readwrite_helper \ sal/osl/unx/socket \ sal/osl/unx/system \ - sal/osl/unx/thread \ sal/osl/unx/time \ )) $(eval $(call gb_Library_add_cobject,sal,sal/osl/unx/signal, \ diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.cxx index 1c703ca1cf42..fc0ff87255a5 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.cxx @@ -144,7 +144,7 @@ static void osl_thread_init_Impl (void) Thread_Impl* osl_thread_construct_Impl (void) { - Thread_Impl* pImpl = malloc (sizeof(Thread_Impl)); + Thread_Impl* pImpl = new Thread_Impl; if (pImpl) { memset (pImpl, 0, sizeof(Thread_Impl)); @@ -171,8 +171,8 @@ static void osl_thread_destruct_Impl (Thread_Impl ** ppImpl) static void osl_thread_cleanup_Impl (Thread_Impl * pImpl) { pthread_t thread; - int attached; - int destroyed; + bool attached; + bool destroyed; pthread_mutex_lock (&(pImpl->m_Lock)); @@ -199,7 +199,7 @@ static void osl_thread_cleanup_Impl (Thread_Impl * pImpl) static void* osl_thread_start_Impl (void* pData) { - int terminate; + bool terminate; Thread_Impl* pImpl= (Thread_Impl*)pData; assert(pImpl); @@ -345,7 +345,7 @@ void SAL_CALL osl_destroyThread(oslThread Thread) { if (Thread != NULL) { Thread_Impl * impl = (Thread_Impl *) Thread; - int active; + bool active; pthread_mutex_lock(&impl->m_Lock); active = (impl->m_Flags & THREADIMPL_FLAGS_ACTIVE) != 0; impl->m_Flags |= THREADIMPL_FLAGS_DESTROYED; @@ -403,7 +403,7 @@ void SAL_CALL osl_suspendThread(oslThread Thread) sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread) { - sal_Bool active; + bool active; Thread_Impl* pImpl= (Thread_Impl*)Thread; if (!pImpl) @@ -419,7 +419,7 @@ sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread) void SAL_CALL osl_joinWithThread(oslThread Thread) { pthread_t thread; - int attached; + bool attached; Thread_Impl* pImpl= (Thread_Impl*)Thread; if (!pImpl) @@ -470,7 +470,7 @@ void SAL_CALL osl_terminateThread(oslThread Thread) sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread) { - int terminate; + bool terminate; Thread_Impl* pImpl= (Thread_Impl*)Thread; OSL_ASSERT(pImpl); @@ -493,7 +493,7 @@ sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread) pthread_mutex_unlock(&(pImpl->m_Lock)); - return (terminate == 0); + return !terminate; } void SAL_CALL osl_waitThread(const TimeValue* pDelay) @@ -938,7 +938,7 @@ void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key) sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData) { - sal_Bool bRet; + bool bRet; void *pOldData = NULL; wrapper_pthread_key *pKey = (wrapper_pthread_key*)Key; if (!pKey) @@ -987,8 +987,7 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding() pthread_once (&(g_thread.m_once), osl_thread_init_Impl); /* check for thread specific encoding, use default if not set */ - threadEncoding = SAL_INT_CAST( - rtl_TextEncoding, + threadEncoding = static_cast<rtl_TextEncoding>( (sal_uIntPtr) pthread_getspecific(g_thread.m_textencoding.m_key)); if (0 == threadEncoding) threadEncoding = g_thread.m_textencoding.m_default; @@ -1003,7 +1002,7 @@ rtl_TextEncoding osl_setThreadTextEncoding(rtl_TextEncoding Encoding) /* save encoding in thread local storage */ pthread_setspecific ( g_thread.m_textencoding.m_key, - (void*) SAL_INT_CAST(sal_uIntPtr, Encoding)); + (void*) static_cast<sal_uIntPtr>(Encoding)); return oldThreadEncoding; } |