Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
0a5dcfe4
Kaydet (Commit)
0a5dcfe4
authored
Şub 23, 2012
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adapted AsynchReader to safer-to-use salhelper::Thread
üst
f7afe3b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
util.cxx
jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+13
-11
No files found.
jvmfwk/plugins/sunmajor/pluginlib/util.cxx
Dosyayı görüntüle @
0a5dcfe4
...
@@ -31,13 +31,13 @@
...
@@ -31,13 +31,13 @@
#include "osl/process.h"
#include "osl/process.h"
#include "osl/security.hxx"
#include "osl/security.hxx"
#include "osl/thread.hxx"
#include "osl/file.hxx"
#include "osl/file.hxx"
#include "osl/module.hxx"
#include "osl/module.hxx"
#include "rtl/byteseq.hxx"
#include "rtl/byteseq.hxx"
#include "rtl/ustrbuf.hxx"
#include "rtl/ustrbuf.hxx"
#include "rtl/instance.hxx"
#include "rtl/instance.hxx"
#include <salhelper/linkhelper.hxx>
#include "salhelper/linkhelper.hxx"
#include "salhelper/thread.hxx"
#include "boost/scoped_array.hpp"
#include "boost/scoped_array.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/Sequence.hxx"
#include <utility>
#include <utility>
...
@@ -294,7 +294,7 @@ FileHandleReader::readLine(rtl::OString * pLine)
...
@@ -294,7 +294,7 @@ FileHandleReader::readLine(rtl::OString * pLine)
}
}
}
}
class
AsynchReader
:
public
Thread
class
AsynchReader
:
public
salhelper
::
Thread
{
{
size_t
m_nDataSize
;
size_t
m_nDataSize
;
boost
::
scoped_array
<
sal_Char
>
m_arData
;
boost
::
scoped_array
<
sal_Char
>
m_arData
;
...
@@ -303,7 +303,9 @@ class AsynchReader: public Thread
...
@@ -303,7 +303,9 @@ class AsynchReader: public Thread
bool
m_bDone
;
bool
m_bDone
;
FileHandleGuard
m_aGuard
;
FileHandleGuard
m_aGuard
;
void
SAL_CALL
run
();
virtual
~
AsynchReader
()
{}
void
execute
();
public
:
public
:
AsynchReader
(
oslFileHandle
&
rHandle
);
AsynchReader
(
oslFileHandle
&
rHandle
);
...
@@ -317,17 +319,17 @@ public:
...
@@ -317,17 +319,17 @@ public:
};
};
AsynchReader
::
AsynchReader
(
oslFileHandle
&
rHandle
)
:
AsynchReader
::
AsynchReader
(
oslFileHandle
&
rHandle
)
:
m_nDataSize
(
0
),
m_bError
(
false
),
m_bDone
(
false
),
m_aGuard
(
rHandle
)
Thread
(
"jvmfwkAsyncReader"
),
m_nDataSize
(
0
),
m_bError
(
false
),
m_bDone
(
false
),
m_aGuard
(
rHandle
)
{
{
}
}
OString
AsynchReader
::
getData
()
OString
AsynchReader
::
getData
()
{
{
OSL_ASSERT
(
isRunning
()
==
sal_False
);
return
OString
(
m_arData
.
get
(),
m_nDataSize
);
return
OString
(
m_arData
.
get
(),
m_nDataSize
);
}
}
void
AsynchReader
::
run
()
void
AsynchReader
::
execute
()
{
{
const
sal_uInt64
BUFFER_SIZE
=
4096
;
const
sal_uInt64
BUFFER_SIZE
=
4096
;
sal_Char
aBuffer
[
BUFFER_SIZE
];
sal_Char
aBuffer
[
BUFFER_SIZE
];
...
@@ -420,7 +422,7 @@ bool getJavaProps(const OUString & exePath,
...
@@ -420,7 +422,7 @@ bool getJavaProps(const OUString & exePath,
oslFileHandle
fileErr
=
0
;
oslFileHandle
fileErr
=
0
;
FileHandleReader
stdoutReader
(
fileOut
);
FileHandleReader
stdoutReader
(
fileOut
);
AsynchReader
stderrReader
(
fileErr
);
rtl
::
Reference
<
AsynchReader
>
stderrReader
(
new
AsynchReader
(
fileErr
)
);
JFW_TRACE2
(
OUSTR
(
"
\n
[Java framework] Executing: "
)
+
exePath
+
OUSTR
(
".
\n
"
));
JFW_TRACE2
(
OUSTR
(
"
\n
[Java framework] Executing: "
)
+
exePath
+
OUSTR
(
".
\n
"
));
oslProcessError
procErr
=
oslProcessError
procErr
=
...
@@ -450,7 +452,7 @@ bool getJavaProps(const OUString & exePath,
...
@@ -450,7 +452,7 @@ bool getJavaProps(const OUString & exePath,
}
}
//Start asynchronous reading (different thread) of error stream
//Start asynchronous reading (different thread) of error stream
stderrReader
.
create
();
stderrReader
->
launch
();
//Use this thread to read output stream
//Use this thread to read output stream
FileHandleReader
::
Result
rs
=
FileHandleReader
::
RESULT_OK
;
FileHandleReader
::
Result
rs
=
FileHandleReader
::
RESULT_OK
;
...
@@ -489,9 +491,9 @@ bool getJavaProps(const OUString & exePath,
...
@@ -489,9 +491,9 @@ bool getJavaProps(const OUString & exePath,
ret
=
true
;
ret
=
true
;
//process error stream data
//process error stream data
stderrReader
.
join
();
stderrReader
->
join
();
JFW_TRACE2
(
"[Java framework] Java wrote to stderr:
\"
"
JFW_TRACE2
(
"[Java framework] Java wrote to stderr:
\"
"
<<
stderrReader
.
getData
().
getStr
()
<<
"
\"
.
\n
"
);
<<
stderrReader
->
getData
().
getStr
()
<<
"
\"
.
\n
"
);
TimeValue
waitMax
=
{
5
,
0
};
TimeValue
waitMax
=
{
5
,
0
};
procErr
=
osl_joinProcessWithTimeout
(
javaProcess
,
&
waitMax
);
procErr
=
osl_joinProcessWithTimeout
(
javaProcess
,
&
waitMax
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment