summaryrefslogtreecommitdiff
path: root/binaryurp
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-02-23 10:30:08 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-02-23 10:47:36 +0100
commitd21fb1451e7260e179b90ed95664f9bebb67eed1 (patch)
tree47204c3fe3b0889d621a1753b4657d429c33fd55 /binaryurp
parent0a5dcfe4a1955879f9a0d08ab5f2e826e9d4c2b9 (diff)
Adapted Reader/Writer to safer-to-use salhelper::Thread
Diffstat (limited to 'binaryurp')
-rw-r--r--binaryurp/source/bridge.cxx6
-rw-r--r--binaryurp/source/reader.cxx12
-rw-r--r--binaryurp/source/reader.hxx21
-rw-r--r--binaryurp/source/writer.cxx11
-rw-r--r--binaryurp/source/writer.hxx20
5 files changed, 16 insertions, 54 deletions
diff --git a/binaryurp/source/bridge.cxx b/binaryurp/source/bridge.cxx
index a47f14e0aa6e..fec485d7a33f 100644
--- a/binaryurp/source/bridge.cxx
+++ b/binaryurp/source/bridge.cxx
@@ -106,7 +106,7 @@ extern "C" void SAL_CALL freeProxyCallback(
static_cast< Proxy * >(pProxy)->do_free();
}
-void joinThread(osl::Thread * thread) {
+void joinThread(salhelper::Thread * thread) {
assert(thread != 0);
if (thread->getIdentifier() != osl::Thread::getCurrentIdentifier()) {
thread->join();
@@ -239,9 +239,9 @@ void Bridge::start() {
threadPool_ = uno_threadpool_create();
assert(threadPool_ != 0);
writer_.set(new Writer(this));
- writer_->create();
+ writer_->launch();
reader_.set(new Reader(this));
- reader_->create();
+ reader_->launch();
}
void Bridge::terminate() {
diff --git a/binaryurp/source/reader.cxx b/binaryurp/source/reader.cxx
index e6b6f06797d9..a871e113b92b 100644
--- a/binaryurp/source/reader.cxx
+++ b/binaryurp/source/reader.cxx
@@ -109,15 +109,15 @@ extern "C" void SAL_CALL request(void * pThreadSpecificData) {
}
-Reader::Reader(rtl::Reference< Bridge > const & bridge): bridge_(bridge) {
+Reader::Reader(rtl::Reference< Bridge > const & bridge):
+ Thread("binaryurpReader"), bridge_(bridge)
+{
assert(bridge.is());
- acquire();
}
Reader::~Reader() {}
-void Reader::run() {
- setName("binaryurpReader");
+void Reader::execute() {
try {
bridge_->sendRequestChangeRequest();
css::uno::Reference< css::connection::XConnection > con(
@@ -153,10 +153,6 @@ void Reader::run() {
bridge_->terminate();
}
-void Reader::onTerminated() {
- release();
-}
-
void Reader::readMessage(Unmarshal & unmarshal) {
sal_uInt8 flags1 = unmarshal.read8();
bool newType;
diff --git a/binaryurp/source/reader.hxx b/binaryurp/source/reader.hxx
index 3fb2fe3af3ad..4fa923b85367 100644
--- a/binaryurp/source/reader.hxx
+++ b/binaryurp/source/reader.hxx
@@ -31,15 +31,11 @@
#include "sal/config.h"
-#include <cstddef>
-
-#include "boost/noncopyable.hpp"
-#include "osl/thread.hxx"
#include "rtl/byteseq.hxx"
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
#include "sal/types.h"
-#include "salhelper/simplereferenceobject.hxx"
+#include "salhelper/thread.hxx"
#include "typelib/typedescription.hxx"
#include "readerstate.hxx"
@@ -52,25 +48,14 @@ namespace binaryurp {
namespace binaryurp {
-class Reader:
- public osl::Thread, public salhelper::SimpleReferenceObject,
- private boost::noncopyable
-{
+class Reader: public salhelper::Thread {
public:
- static void * operator new(std::size_t size)
- { return Thread::operator new(size); }
-
- static void operator delete(void * pointer)
- { Thread::operator delete(pointer); }
-
explicit Reader(rtl::Reference< Bridge > const & bridge);
private:
virtual ~Reader();
- virtual void SAL_CALL run();
-
- virtual void SAL_CALL onTerminated();
+ virtual void execute();
void readMessage(Unmarshal & unmarshal);
diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx
index 843f667cfcbd..f5ded2927fea 100644
--- a/binaryurp/source/writer.cxx
+++ b/binaryurp/source/writer.cxx
@@ -77,10 +77,10 @@ Writer::Item::Item(
{}
Writer::Writer(rtl::Reference< Bridge > const & bridge):
- bridge_(bridge), marshal_(bridge, state_), stop_(false)
+ Thread("binaryurpWriter"), bridge_(bridge), marshal_(bridge, state_),
+ stop_(false)
{
OSL_ASSERT(bridge.is());
- acquire();
}
void Writer::sendDirectRequest(
@@ -148,8 +148,7 @@ void Writer::stop() {
Writer::~Writer() {}
-void Writer::run() {
- setName("binaryurpWriter");
+void Writer::execute() {
try {
unblocked_.wait();
for (;;) {
@@ -199,10 +198,6 @@ void Writer::run() {
bridge_->terminate();
}
-void Writer::onTerminated() {
- release();
-}
-
void Writer::sendRequest(
rtl::ByteSequence const & tid, rtl::OUString const & oid,
css::uno::TypeDescription const & type,
diff --git a/binaryurp/source/writer.hxx b/binaryurp/source/writer.hxx
index 60d097e87647..e7ae0a24573b 100644
--- a/binaryurp/source/writer.hxx
+++ b/binaryurp/source/writer.hxx
@@ -31,19 +31,15 @@
#include "sal/config.h"
-#include <cstddef>
#include <deque>
#include <vector>
-#include "boost/noncopyable.hpp"
#include "osl/conditn.hxx"
#include "osl/mutex.hxx"
-#include "osl/thread.hxx"
#include "rtl/byteseq.hxx"
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
-#include "sal/types.h"
-#include "salhelper/simplereferenceobject.hxx"
+#include "salhelper/thread.hxx"
#include "typelib/typedescription.hxx"
#include "uno/dispatcher.hxx"
@@ -55,17 +51,9 @@ namespace binaryurp { class Bridge; }
namespace binaryurp {
-class Writer:
- public osl::Thread, public salhelper::SimpleReferenceObject,
- private boost::noncopyable
+class Writer: public salhelper::Thread
{
public:
- static void * operator new(std::size_t size)
- { return Thread::operator new(size); }
-
- static void operator delete(void * pointer)
- { Thread::operator delete(pointer); }
-
explicit Writer(rtl::Reference< Bridge > const & bridge);
// Only called from Bridge::reader_ thread, and only before Bridge::writer_
@@ -104,9 +92,7 @@ public:
private:
virtual ~Writer();
- virtual void SAL_CALL run();
-
- virtual void SAL_CALL onTerminated();
+ virtual void execute();
void sendRequest(
rtl::ByteSequence const & tid, rtl::OUString const & oid,