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
04f02c65
Kaydet (Commit)
04f02c65
authored
Agu 06, 2016
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
use std::thread instead of own solution
Change-Id: Id3d71897127c7af39688c9071dbb0e04b08fb327
üst
7d16d987
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
71 deletions
+8
-71
updater.cxx
onlineupdate/source/update/updater/updater.cxx
+8
-71
No files found.
onlineupdate/source/update/updater/updater.cxx
Dosyayı görüntüle @
04f02c65
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include "readstrings.h"
#include "readstrings.h"
#include "errors.h"
#include "errors.h"
#include "bzlib.h"
#include "bzlib.h"
#include <thread>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
...
@@ -214,68 +215,6 @@ struct MARChannelStringTable {
...
@@ -214,68 +215,6 @@ struct MARChannelStringTable {
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
typedef
void
(
*
ThreadFunc
)(
void
*
param
);
#ifdef _WIN32
#include <process.h>
class
Thread
{
public
:
int
Run
(
ThreadFunc
func
,
void
*
param
)
{
mThreadFunc
=
func
;
mThreadParam
=
param
;
unsigned
int
threadID
;
mThread
=
(
HANDLE
)
_beginthreadex
(
nullptr
,
0
,
ThreadMain
,
this
,
0
,
&
threadID
);
return
mThread
?
0
:
-
1
;
}
int
Join
()
{
WaitForSingleObject
(
mThread
,
INFINITE
);
CloseHandle
(
mThread
);
return
0
;
}
private
:
static
unsigned
__stdcall
ThreadMain
(
void
*
p
)
{
Thread
*
self
=
(
Thread
*
)
p
;
self
->
mThreadFunc
(
self
->
mThreadParam
);
return
0
;
}
HANDLE
mThread
;
ThreadFunc
mThreadFunc
;
void
*
mThreadParam
;
};
#elif defined(UNIX)
#include <pthread.h>
class
Thread
{
public
:
int
Run
(
ThreadFunc
func
,
void
*
param
)
{
return
pthread_create
(
&
thr
,
nullptr
,
(
void
*
(
*
)(
void
*
))
func
,
param
);
}
int
Join
()
{
void
*
result
;
return
pthread_join
(
thr
,
&
result
);
}
private
:
pthread_t
thr
;
};
#else
#error "Unsupported platform"
#endif
//-----------------------------------------------------------------------------
static
NS_tchar
*
gPatchDirPath
;
static
NS_tchar
*
gPatchDirPath
;
static
NS_tchar
gInstallDirPath
[
MAXPATHLEN
];
static
NS_tchar
gInstallDirPath
[
MAXPATHLEN
];
static
NS_tchar
gWorkingDirPath
[
MAXPATHLEN
];
static
NS_tchar
gWorkingDirPath
[
MAXPATHLEN
];
...
@@ -2751,12 +2690,11 @@ int NS_main(int argc, NS_tchar **argv)
...
@@ -2751,12 +2690,11 @@ int NS_main(int argc, NS_tchar **argv)
// has still not stopped then show an indeterminate progress bar.
// has still not stopped then show an indeterminate progress bar.
DWORD
lastState
=
WaitForServiceStop
(
SVC_NAME
,
5
);
DWORD
lastState
=
WaitForServiceStop
(
SVC_NAME
,
5
);
if
(
lastState
!=
SERVICE_STOPPED
)
{
if
(
lastState
!=
SERVICE_STOPPED
)
{
Thread
t1
;
std
::
thread
waitThread
(
WaitForServiceFinishThread
,
nullptr
);
if
(
t1
.
Run
(
WaitForServiceFinishThread
,
nullptr
)
==
0
&&
if
(
showProgressUI
)
{
showProgressUI
)
{
ShowProgressUI
(
true
,
false
);
ShowProgressUI
(
true
,
false
);
}
}
t1
.
J
oin
();
waitThread
.
j
oin
();
}
}
lastState
=
WaitForServiceStop
(
SVC_NAME
,
1
);
lastState
=
WaitForServiceStop
(
SVC_NAME
,
1
);
...
@@ -3101,13 +3039,12 @@ int NS_main(int argc, NS_tchar **argv)
...
@@ -3101,13 +3039,12 @@ int NS_main(int argc, NS_tchar **argv)
// Run update process on a background thread. ShowProgressUI may return
// Run update process on a background thread. ShowProgressUI may return
// before QuitProgressUI has been called, so wait for UpdateThreadFunc to
// before QuitProgressUI has been called, so wait for UpdateThreadFunc to
// terminate. Avoid showing the progress UI when staging an update.
// terminate. Avoid showing the progress UI when staging an update.
Thread
t
;
std
::
thread
updateThread
(
UpdateThreadFunc
,
nullptr
)
;
if
(
t
.
Run
(
UpdateThreadFunc
,
nullptr
)
==
0
)
{
if
(
!
sStagedUpdate
&&
!
sReplaceRequest
)
if
(
!
sStagedUpdate
&&
!
sReplaceRequest
)
{
{
ShowProgressUI
();
ShowProgressUI
();
}
}
}
t
.
J
oin
();
updateThread
.
j
oin
();
#ifdef _WIN32
#ifdef _WIN32
if
(
argc
>
callbackIndex
&&
!
sReplaceRequest
)
{
if
(
argc
>
callbackIndex
&&
!
sReplaceRequest
)
{
...
...
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