summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2017-05-07 04:34:35 +1000
committerChris Sherlock <chris.sherlock79@gmail.com>2017-05-07 04:36:22 +1000
commit53666e68ef30415a7c89919442e429269e2606f2 (patch)
tree2d227aebac16b91f54d1ebcaba0beaadde6a67e1 /sal
parentadf0f0f103b10842b660fb94da77ead04f080907 (diff)
osl: remove comment cruft, whitespace cleanup of thread.cxx
Change-Id: I4941e02b011b8e630b00d8a14703651d1f956563
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/thread.cxx30
-rw-r--r--sal/osl/w32/thread.cxx73
2 files changed, 11 insertions, 92 deletions
diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index 0e235757501b..a4a666ff2b31 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -70,10 +70,6 @@
*
****************************************************************************/
-/*****************************************************************************/
-/* Internal data structures and functions */
-/*****************************************************************************/
-
#define THREADIMPL_FLAGS_TERMINATE 0x00001
#define THREADIMPL_FLAGS_STARTUP 0x00002
#define THREADIMPL_FLAGS_SUSPENDED 0x00004
@@ -439,12 +435,12 @@ void SAL_CALL osl_joinWithThread(oslThread Thread)
pthread_t const thread = pImpl->m_hThread;
bool const attached = ((pImpl->m_Flags & THREADIMPL_FLAGS_ATTACHED) > 0);
- // check this only if *this* thread is still attached - if it's not,
- // then it could have terminated and another newly created thread could
- // have recycled the same id as m_hThread!
+ /* check this only if *this* thread is still attached - if it's not,
+ then it could have terminated and another newly created thread could
+ have recycled the same id as m_hThread! */
if (attached && pthread_equal(pthread_self(), pImpl->m_hThread))
{
- assert(false); // Win32 implementation would deadlock here!
+ assert(false); /* Win32 implementation would deadlock here! */
/* self join */
pthread_mutex_unlock (&(pImpl->m_Lock));
return; /* EDEADLK */
@@ -528,14 +524,12 @@ void SAL_CALL osl_waitThread(const TimeValue* pDelay)
}
}
-/*****************************************************************************/
-/* osl_yieldThread */
-/*
- Note that POSIX scheduling _really_ requires threads to call this
+/** Yields thread
+
+ @attention Note that POSIX scheduling @em really requires threads to call this
function, since a thread only reschedules to other thread, when
it blocks (sleep, blocking I/O) OR calls sched_yield().
*/
-/*****************************************************************************/
void SAL_CALL osl_yieldThread()
{
sched_yield();
@@ -552,9 +546,7 @@ void SAL_CALL osl_setThreadName(char const * name) {
#endif
}
-/*****************************************************************************/
/* osl_getThreadIdentifier @@@ see TODO @@@ */
-/*****************************************************************************/
struct HashEntry
{
@@ -786,14 +778,11 @@ static void osl_thread_priority_init_Impl()
#endif /* NO_PTHREAD_PRIORITY */
}
-/*****************************************************************************/
-/* osl_setThreadPriority */
-/*
+/**
Impl-Notes: contrary to solaris-docu, which claims
valid priority-levels from 0 .. INT_MAX, only the
range 0..127 is accepted. (0 lowest, 127 highest)
*/
-/*****************************************************************************/
void SAL_CALL osl_setThreadPriority (
oslThread Thread,
oslThreadPriority Priority)
@@ -1001,9 +990,6 @@ sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData)
return bRet;
}
-/*****************************************************************************/
-/* Thread Local Text Encoding */
-/*****************************************************************************/
static void osl_thread_textencoding_init_Impl()
{
rtl_TextEncoding defaultEncoding;
diff --git a/sal/osl/w32/thread.cxx b/sal/osl/w32/thread.cxx
index 324437009717..6de040c482f2 100644
--- a/sal/osl/w32/thread.cxx
+++ b/sal/osl/w32/thread.cxx
@@ -28,9 +28,9 @@
#include <rtl/tencinfo.h>
#include <errno.h>
-/*
+/**
Thread-data structure hidden behind oslThread:
-*/
+ */
typedef struct
{
HANDLE m_hThread; /* OS-handle used for all thread-functions */
@@ -44,9 +44,6 @@ typedef struct
static unsigned __stdcall oslWorkerWrapperFunction(void* pData);
static oslThread oslCreateThread(oslWorkerFunction pWorker, void* pThreadData, sal_uInt32 nFlags);
-/*****************************************************************************/
-/* oslWorkerWrapperFunction */
-/*****************************************************************************/
static unsigned __stdcall oslWorkerWrapperFunction(void* pData)
{
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(pData);
@@ -63,9 +60,6 @@ static unsigned __stdcall oslWorkerWrapperFunction(void* pData)
return 0;
}
-/*****************************************************************************/
-/* oslCreateThread */
-/*****************************************************************************/
static oslThread oslCreateThread(oslWorkerFunction pWorker,
void* pThreadData,
sal_uInt32 nFlags)
@@ -123,27 +117,18 @@ static oslThread oslCreateThread(oslWorkerFunction pWorker,
return pThreadImpl;
}
-/*****************************************************************************/
-/* osl_createThread */
-/*****************************************************************************/
oslThread SAL_CALL osl_createThread(oslWorkerFunction pWorker,
void* pThreadData)
{
return oslCreateThread(pWorker, pThreadData, 0);
}
-/*****************************************************************************/
-/* osl_createSuspendedThread */
-/*****************************************************************************/
oslThread SAL_CALL osl_createSuspendedThread(oslWorkerFunction pWorker,
void* pThreadData)
{
return oslCreateThread(pWorker, pThreadData, CREATE_SUSPENDED);
}
-/*****************************************************************************/
-/* osl_getThreadIdentifier */
-/*****************************************************************************/
oslThreadIdentifier SAL_CALL osl_getThreadIdentifier(oslThread Thread)
{
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(Thread);
@@ -154,9 +139,6 @@ oslThreadIdentifier SAL_CALL osl_getThreadIdentifier(oslThread Thread)
return (oslThreadIdentifier)GetCurrentThreadId();
}
-/*****************************************************************************/
-/* osl_destroyThread */
-/*****************************************************************************/
void SAL_CALL osl_destroyThread(oslThread Thread)
{
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(Thread);
@@ -174,9 +156,6 @@ void SAL_CALL osl_destroyThread(oslThread Thread)
free(Thread);
}
-/*****************************************************************************/
-/* osl_resumeThread */
-/*****************************************************************************/
void SAL_CALL osl_resumeThread(oslThread Thread)
{
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(Thread);
@@ -186,9 +165,6 @@ void SAL_CALL osl_resumeThread(oslThread Thread)
ResumeThread(pThreadImpl->m_hThread);
}
-/*****************************************************************************/
-/* osl_suspendThread */
-/*****************************************************************************/
void SAL_CALL osl_suspendThread(oslThread Thread)
{
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(Thread);
@@ -198,9 +174,6 @@ void SAL_CALL osl_suspendThread(oslThread Thread)
SuspendThread(pThreadImpl->m_hThread);
}
-/*****************************************************************************/
-/* osl_setThreadPriority */
-/*****************************************************************************/
void SAL_CALL osl_setThreadPriority(oslThread Thread,
oslThreadPriority Priority)
{
@@ -252,9 +225,6 @@ void SAL_CALL osl_setThreadPriority(oslThread Thread,
SetThreadPriority(pThreadImpl->m_hThread, winPriority);
}
-/*****************************************************************************/
-/* osl_getThreadPriority */
-/*****************************************************************************/
oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread)
{
int winPriority;
@@ -302,7 +272,7 @@ oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread)
break;
default:
- OSL_ASSERT(FALSE); /* WIN32 API changed, incorporate new prio-level! */
+ OSL_ASSERT(FALSE); /* WIN32 API changed, incorporate new prio-level! */
/* release-version behaves friendly */
Priority= osl_Thread_PriorityUnknown;
@@ -311,9 +281,6 @@ oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread)
return Priority;
}
-/*****************************************************************************/
-/* osl_isThreadRunning */
-/*****************************************************************************/
sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread)
{
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(Thread);
@@ -327,9 +294,6 @@ sal_Bool SAL_CALL osl_isThreadRunning(const oslThread Thread)
return WaitForSingleObject(pThreadImpl->m_hThread, 0) != WAIT_OBJECT_0;
}
-/*****************************************************************************/
-/* osl_joinWithThread */
-/*****************************************************************************/
void SAL_CALL osl_joinWithThread(oslThread Thread)
{
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(Thread);
@@ -344,9 +308,6 @@ void SAL_CALL osl_joinWithThread(oslThread Thread)
WaitForSingleObject(pThreadImpl->m_hThread, INFINITE);
}
-/*****************************************************************************/
-/* osl_waitThread */
-/*****************************************************************************/
void SAL_CALL osl_waitThread(const TimeValue* pDelay)
{
if (pDelay)
@@ -357,9 +318,6 @@ void SAL_CALL osl_waitThread(const TimeValue* pDelay)
}
}
-/*****************************************************************************/
-/* osl_terminateThread */
-/*****************************************************************************/
void SAL_CALL osl_terminateThread(oslThread Thread)
{
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(Thread);
@@ -374,9 +332,6 @@ void SAL_CALL osl_terminateThread(oslThread Thread)
osl_atomic_increment(&(pThreadImpl->m_nTerminationRequested));
}
-/*****************************************************************************/
-/* osl_scheduleThread */
-/*****************************************************************************/
sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread)
{
osl_TThreadImpl* pThreadImpl= static_cast<osl_TThreadImpl*>(Thread);
@@ -393,9 +348,6 @@ sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread)
return 0 == pThreadImpl->m_nTerminationRequested;
}
-/*****************************************************************************/
-/* osl_yieldThread */
-/*****************************************************************************/
void SAL_CALL osl_yieldThread(void)
{
Sleep(0);
@@ -494,9 +446,6 @@ void SAL_CALL osl_callThreadKeyCallbackOnThreadDetach(void)
LeaveCriticalSection( &g_ThreadKeyListCS );
}
-/*****************************************************************************/
-/* osl_createThreadKey */
-/*****************************************************************************/
oslThreadKey SAL_CALL osl_createThreadKey(oslThreadKeyCallbackFunction pCallback)
{
PTLS pTls = static_cast<PTLS>(rtl_allocateMemory( sizeof(TLS) ));
@@ -516,9 +465,6 @@ oslThreadKey SAL_CALL osl_createThreadKey(oslThreadKeyCallbackFunction pCallback
return pTls;
}
-/*****************************************************************************/
-/* osl_destroyThreadKey */
-/*****************************************************************************/
void SAL_CALL osl_destroyThreadKey(oslThreadKey Key)
{
if (Key != nullptr)
@@ -531,9 +477,6 @@ void SAL_CALL osl_destroyThreadKey(oslThreadKey Key)
}
}
-/*****************************************************************************/
-/* osl_getThreadKeyData */
-/*****************************************************************************/
void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key)
{
if (Key != nullptr)
@@ -546,9 +489,6 @@ void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key)
return nullptr;
}
-/*****************************************************************************/
-/* osl_setThreadKeyData */
-/*****************************************************************************/
sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData)
{
if (Key != nullptr)
@@ -571,10 +511,6 @@ sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData)
return false;
}
-/*****************************************************************************/
-/* osl_getThreadTextEncoding */
-/*****************************************************************************/
-
DWORD g_dwTLSTextEncodingIndex = (DWORD)-1;
rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void)
@@ -599,9 +535,6 @@ rtl_TextEncoding SAL_CALL osl_getThreadTextEncoding(void)
return _encoding;
}
-/*****************************************************************************/
-/* osl_getThreadTextEncoding */
-/*****************************************************************************/
rtl_TextEncoding SAL_CALL osl_setThreadTextEncoding( rtl_TextEncoding Encoding )
{
rtl_TextEncoding oldEncoding = osl_getThreadTextEncoding();