Kaydet (Commit) b162753e authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Use osl/thread.h abstraction

...which already takes care of things like increasing stack size under ASan

Change-Id: I89f9a25a660aacd41e1125766b23f7be395e7af8
üst 50352258
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <tools/errinf.hxx> #include <tools/errinf.hxx>
#include <osl/file.hxx> #include <osl/file.hxx>
#include <osl/process.h> #include <osl/process.h>
#include <osl/thread.h>
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
#include <rtl/bootstrap.hxx> #include <rtl/bootstrap.hxx>
#include <cppuhelper/bootstrap.hxx> #include <cppuhelper/bootstrap.hxx>
...@@ -277,7 +278,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit ...@@ -277,7 +278,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
{ {
OUString maLastExceptionMsg; OUString maLastExceptionMsg;
shared_ptr< LibreOfficeKitClass > m_pOfficeClass; shared_ptr< LibreOfficeKitClass > m_pOfficeClass;
pthread_t maThread; oslThread maThread;
LibLibreOffice_Impl() LibLibreOffice_Impl()
: maThread(0) : maThread(0)
...@@ -813,10 +814,9 @@ static bool initialize_uno(const OUString& aAppProgramURL) ...@@ -813,10 +814,9 @@ static bool initialize_uno(const OUString& aAppProgramURL)
return true; return true;
} }
static void* lo_startmain(void*) static void lo_startmain(void*)
{ {
soffice_main(); soffice_main();
return 0;
} }
static bool bInitialized = false; static bool bInitialized = false;
...@@ -885,7 +885,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath) ...@@ -885,7 +885,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath)
SAL_INFO("lok", "Enabling OfficeIPCThread"); SAL_INFO("lok", "Enabling OfficeIPCThread");
OfficeIPCThread::EnableOfficeIPCThread(); OfficeIPCThread::EnableOfficeIPCThread();
SAL_INFO("lok", "Starting soffice_main"); SAL_INFO("lok", "Starting soffice_main");
pthread_create(&(pLib->maThread), 0, lo_startmain, NULL); pLib->maThread = osl_createThread(lo_startmain, NULL);
SAL_INFO("lok", "Waiting for OfficeIPCThread"); SAL_INFO("lok", "Waiting for OfficeIPCThread");
OfficeIPCThread::WaitForReady(); OfficeIPCThread::WaitForReady();
SAL_INFO("lok", "OfficeIPCThread ready -- continuing"); SAL_INFO("lok", "OfficeIPCThread ready -- continuing");
...@@ -948,7 +948,8 @@ static void lo_destroy(LibreOfficeKit* pThis) ...@@ -948,7 +948,8 @@ static void lo_destroy(LibreOfficeKit* pThis)
SAL_INFO("lok", "LO Destroy"); SAL_INFO("lok", "LO Destroy");
Application::Quit(); Application::Quit();
pthread_join(pLib->maThread, NULL); osl_joinWithThread(pLib->maThread);
osl_destroyThread(pLib->maThread);
delete pLib; delete pLib;
bInitialized = false; bInitialized = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment