Philipp, all,
Hm, is this a (misguided, IMO) attempt at making the code more robust?
Re the check in the dor: The osl_destroyThread documentation says "If
Thread is NULL, the function won't do anything." Why not rely on this?
Re the other checks: Is it useful to have those functions silently noop
for a non-created thread? I would guess that any code that relies on
those newly introduced checks is already in error, and should rather be
exposed and fixed rather than hidden. (Also, getIdentifier for
m_hTread==NULL confusingly returns the id of the current thread, at
least in the osl/unx branch.)
Just my 2cents/sorry for bothering,
-Stephan
[EMAIL PROTECTED] wrote:
Tag: cws_src680_vcl74
User: pl
Date: 2007/02/12 04:30:40
Modified:
porting/sal/inc/osl/thread.hxx
Log:
#i67603# avoid unnecessary assertions
File Changes:
Directory: /porting/sal/inc/osl/
================================
File [changed]: thread.hxx
Url:
http://porting.openoffice.org/source/browse/porting/sal/inc/osl/thread.hxx?r1=1.8&r2=1.8.212.1
Delta lines: +18 -12
---------------------
--- thread.hxx 8 Sep 2005 14:34:15 -0000 1.8
+++ thread.hxx 12 Feb 2007 12:30:38 -0000 1.8.212.1
@@ -4,9 +4,9 @@
*
* $RCSfile: thread.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.8.212.1 $
*
- * last change: $Author: rt $ $Date: 2005/09/08 14:34:15 $
+ * last change: $Author: pl $ $Date: 2007/02/12 12:30:38 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -81,6 +81,7 @@
virtual ~Thread()
{
+ if( m_hThread )
osl_destroyThread( m_hThread);
}
@@ -109,21 +110,25 @@
virtual void SAL_CALL suspend()
{
+ if( m_hThread )
osl_suspendThread(m_hThread);
}
virtual void SAL_CALL resume()
{
+ if( m_hThread )
osl_resumeThread(m_hThread);
}
virtual void SAL_CALL terminate()
{
+ if( m_hThread )
osl_terminateThread(m_hThread);
}
virtual void SAL_CALL join()
{
+ if( m_hThread )
osl_joinWithThread(m_hThread);
}
@@ -134,12 +139,13 @@
void SAL_CALL setPriority( oslThreadPriority Priority)
{
+ if( m_hThread )
osl_setThreadPriority(m_hThread, Priority);
}
oslThreadPriority SAL_CALL getPriority()
{
- return osl_getThreadPriority(m_hThread);
+ return m_hThread ? osl_getThreadPriority(m_hThread) :
osl_Thread_PriorityUnknown;
}
oslThreadIdentifier SAL_CALL getIdentifier() const
@@ -165,7 +171,7 @@
virtual sal_Bool SAL_CALL schedule()
{
- return osl_scheduleThread(m_hThread);
+ return m_hThread ? osl_scheduleThread(m_hThread) : sal_False;
}
SAL_CALL operator oslThread() const
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]