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

sal/osl/unx/thread.c -> .cxx

Change-Id: I6cb46a51dda3fda51a3b6413656da15fc5bdb04d
üst fc04f763
...@@ -14,6 +14,5 @@ ...@@ -14,6 +14,5 @@
#include <sal/osl/unx/nlsupport.c> #include <sal/osl/unx/nlsupport.c>
#include <sal/osl/unx/pipe.c> #include <sal/osl/unx/pipe.c>
#include <sal/osl/unx/readwrite_helper.c> #include <sal/osl/unx/readwrite_helper.c>
#include <sal/osl/unx/thread.c>
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <sal/osl/unx/process_impl.cxx> #include <sal/osl/unx/process_impl.cxx>
#include <sal/osl/unx/profile.cxx> #include <sal/osl/unx/profile.cxx>
#include <sal/osl/unx/security.cxx> #include <sal/osl/unx/security.cxx>
#include <sal/osl/unx/thread.cxx>
#include <sal/osl/unx/uunxapi.cxx> #include <sal/osl/unx/uunxapi.cxx>
#include <sal/rtl/alloc_arena.cxx> #include <sal/rtl/alloc_arena.cxx>
#include <sal/rtl/alloc_cache.cxx> #include <sal/rtl/alloc_cache.cxx>
......
...@@ -167,6 +167,7 @@ $(eval $(call gb_Library_add_exception_objects,sal,\ ...@@ -167,6 +167,7 @@ $(eval $(call gb_Library_add_exception_objects,sal,\
sal/osl/unx/profile \ sal/osl/unx/profile \
sal/osl/unx/security \ sal/osl/unx/security \
sal/osl/unx/tempfile \ sal/osl/unx/tempfile \
sal/osl/unx/thread \
$(if $(filter DESKTOP,$(BUILD_TYPE)), sal/osl/unx/salinit) \ $(if $(filter DESKTOP,$(BUILD_TYPE)), sal/osl/unx/salinit) \
)) ))
$(eval $(call gb_Library_add_cobjects,sal,\ $(eval $(call gb_Library_add_cobjects,sal,\
...@@ -177,7 +178,6 @@ $(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/readwrite_helper \
sal/osl/unx/socket \ sal/osl/unx/socket \
sal/osl/unx/system \ sal/osl/unx/system \
sal/osl/unx/thread \
sal/osl/unx/time \ sal/osl/unx/time \
)) ))
$(eval $(call gb_Library_add_cobject,sal,sal/osl/unx/signal, \ $(eval $(call gb_Library_add_cobject,sal,sal/osl/unx/signal, \
......
...@@ -144,7 +144,7 @@ static void osl_thread_init_Impl (void) ...@@ -144,7 +144,7 @@ static void osl_thread_init_Impl (void)
Thread_Impl* osl_thread_construct_Impl (void) Thread_Impl* osl_thread_construct_Impl (void)
{ {
Thread_Impl* pImpl = malloc (sizeof(Thread_Impl)); Thread_Impl* pImpl = new Thread_Impl;
if (pImpl) if (pImpl)
{ {
memset (pImpl, 0, sizeof(Thread_Impl)); memset (pImpl, 0, sizeof(Thread_Impl));
...@@ -171,8 +171,8 @@ static void osl_thread_destruct_Impl (Thread_Impl ** ppImpl) ...@@ -171,8 +171,8 @@ static void osl_thread_destruct_Impl (Thread_Impl ** ppImpl)
static void osl_thread_cleanup_Impl (Thread_Impl * pImpl) static void osl_thread_cleanup_Impl (Thread_Impl * pImpl)
{ {
pthread_t thread; pthread_t thread;
int attached; bool attached;
int destroyed; bool destroyed;
pthread_mutex_lock (&(pImpl->m_Lock)); pthread_mutex_lock (&(pImpl->m_Lock));
...@@ -199,7 +199,7 @@ static void osl_thread_cleanup_Impl (Thread_Impl * pImpl) ...@@ -199,7 +199,7 @@ static void osl_thread_cleanup_Impl (Thread_Impl * pImpl)
static void* osl_thread_start_Impl (void* pData) static void* osl_thread_start_Impl (void* pData)
{ {
int terminate; bool terminate;
Thread_Impl* pImpl= (Thread_Impl*)pData; Thread_Impl* pImpl= (Thread_Impl*)pData;
assert(pImpl); assert(pImpl);
...@@ -345,7 +345,7 @@ void SAL_CALL osl_destroyThread(oslThread Thread) ...@@ -345,7 +345,7 @@ void SAL_CALL osl_destroyThread(oslThread Thread)
{ {
if (Thread != NULL) { if (Thread != NULL) {
Thread_Impl * impl = (Thread_Impl *) Thread; Thread_Impl * impl = (Thread_Impl *) Thread;
int active; bool active;
pthread_mutex_lock(&impl->m_Lock); pthread_mutex_lock(&impl->m_Lock);
active = (impl->m_Flags & THREADIMPL_FLAGS_ACTIVE) != 0; active = (impl->m_Flags & THREADIMPL_FLAGS_ACTIVE) != 0;
impl->m_Flags |= THREADIMPL_FLAGS_DESTROYED; impl->m_Flags |= THREADIMPL_FLAGS_DESTROYED;
...@@ -403,7 +403,7 @@ void SAL_CALL osl_suspendThread(oslThread Thread) ...@@ -403,7 +403,7 @@ void SAL_CALL osl_suspendThread(oslThread Thread)
sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread) sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread)
{ {
sal_Bool active; bool active;
Thread_Impl* pImpl= (Thread_Impl*)Thread; Thread_Impl* pImpl= (Thread_Impl*)Thread;
if (!pImpl) if (!pImpl)
...@@ -419,7 +419,7 @@ sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread) ...@@ -419,7 +419,7 @@ sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread)
void SAL_CALL osl_joinWithThread(oslThread Thread) void SAL_CALL osl_joinWithThread(oslThread Thread)
{ {
pthread_t thread; pthread_t thread;
int attached; bool attached;
Thread_Impl* pImpl= (Thread_Impl*)Thread; Thread_Impl* pImpl= (Thread_Impl*)Thread;
if (!pImpl) if (!pImpl)
...@@ -470,7 +470,7 @@ void SAL_CALL osl_terminateThread(oslThread Thread) ...@@ -470,7 +470,7 @@ void SAL_CALL osl_terminateThread(oslThread Thread)
sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread) sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread)
{ {
int terminate; bool terminate;
Thread_Impl* pImpl= (Thread_Impl*)Thread; Thread_Impl* pImpl= (Thread_Impl*)Thread;
OSL_ASSERT(pImpl); OSL_ASSERT(pImpl);
...@@ -493,7 +493,7 @@ sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread) ...@@ -493,7 +493,7 @@ sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread)
pthread_mutex_unlock(&(pImpl->m_Lock)); pthread_mutex_unlock(&(pImpl->m_Lock));
return (terminate == 0); return !terminate;
} }
void SAL_CALL osl_waitThread(const TimeValue* pDelay) void SAL_CALL osl_waitThread(const TimeValue* pDelay)
...@@ -938,7 +938,7 @@ void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key) ...@@ -938,7 +938,7 @@ void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key)
sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData) sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData)
{ {
sal_Bool bRet; bool bRet;
void *pOldData = NULL; void *pOldData = NULL;
wrapper_pthread_key *pKey = (wrapper_pthread_key*)Key; wrapper_pthread_key *pKey = (wrapper_pthread_key*)Key;
if (!pKey) if (!pKey)
...@@ -987,8 +987,7 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding() ...@@ -987,8 +987,7 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding()
pthread_once (&(g_thread.m_once), osl_thread_init_Impl); pthread_once (&(g_thread.m_once), osl_thread_init_Impl);
/* check for thread specific encoding, use default if not set */ /* check for thread specific encoding, use default if not set */
threadEncoding = SAL_INT_CAST( threadEncoding = static_cast<rtl_TextEncoding>(
rtl_TextEncoding,
(sal_uIntPtr) pthread_getspecific(g_thread.m_textencoding.m_key)); (sal_uIntPtr) pthread_getspecific(g_thread.m_textencoding.m_key));
if (0 == threadEncoding) if (0 == threadEncoding)
threadEncoding = g_thread.m_textencoding.m_default; threadEncoding = g_thread.m_textencoding.m_default;
...@@ -1003,7 +1002,7 @@ rtl_TextEncoding osl_setThreadTextEncoding(rtl_TextEncoding Encoding) ...@@ -1003,7 +1002,7 @@ rtl_TextEncoding osl_setThreadTextEncoding(rtl_TextEncoding Encoding)
/* save encoding in thread local storage */ /* save encoding in thread local storage */
pthread_setspecific ( pthread_setspecific (
g_thread.m_textencoding.m_key, g_thread.m_textencoding.m_key,
(void*) SAL_INT_CAST(sal_uIntPtr, Encoding)); (void*) static_cast<sal_uIntPtr>(Encoding));
return oldThreadEncoding; return oldThreadEncoding;
} }
......
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