summaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorJörg Budischewski <jbu@openoffice.org>2000-12-04 11:42:47 +0000
committerJörg Budischewski <jbu@openoffice.org>2000-12-04 11:42:47 +0000
commit0987cdbfd12781056090277ed888c48b84d6059d (patch)
tree0626cfcbc9a3d56258ff32a113beba179591a74f /io
parent1a377f43c94f29030989c9c8466b6f61b5691dc1 (diff)
#81045# pump now holds itself as long as thread is running
Diffstat (limited to 'io')
-rw-r--r--io/source/stm/opump.cxx24
1 files changed, 18 insertions, 6 deletions
diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx
index 503716f28fee..3bced7ae0b04 100644
--- a/io/source/stm/opump.cxx
+++ b/io/source/stm/opump.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: opump.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: svesik $ $Date: 2000-11-23 14:42:26 $
+ * last change: $Author: jbu $ $Date: 2000-12-04 12:42:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -202,16 +202,25 @@ void Pump::run()
try
{
+ if( ! m_xInput.is() )
+ {
+ NotConnectedException exception(
+ OUString::createFromAscii( "no input stream set" ) , Reference<XInterface>((OWeakObject*)this) );
+ throw exception;
+ }
Sequence< sal_Int8 > aData;
long nBytes;
- while( nBytes = m_xInput->readBytes( aData, 65536 ) )
+ while( nBytes = m_xInput->readSomeBytes( aData, 65536 ) )
{
+ if( ! m_xOutput.is() )
+ {
+ NotConnectedException exception(
+ OUString::createFromAscii( "no output stream set" ) , Reference<XInterface>( (OWeakObject*)this) );
+ throw exception;
+ }
m_xOutput->writeBytes( aData );
- if( nBytes < 65536 ) // marks EOF or error
- break;
osl_yieldThread();
}
-
}
catch ( IOException & e )
{
@@ -257,6 +266,8 @@ void Pump::run()
OString sMessage = OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US );
OSL_ENSHURE( !"com.sun.star.comp.stoc.Pump: unexpected exception", sMessage.getStr() );
}
+
+ release();
}
// ------------------------------------------------------------
@@ -327,6 +338,7 @@ void Pump::start() throw()
{
Guard< Mutex > aGuard( m_aMutex );
+ acquire();
m_aThread = osl_createThread(
(oslWorkerFunction)Pump::static_run,
(void*)this