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
2861d5be
Kaydet (Commit)
2861d5be
authored
Agu 18, 2015
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Some oslCondition -> osl::Condition
Change-Id: I86cfbefd1cb8b22fca659a158b8e31d5c991de7a
üst
5d6ef74e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
28 deletions
+22
-28
jobqueue.cxx
cppu/source/threadpool/jobqueue.cxx
+7
-15
jobqueue.hxx
cppu/source/threadpool/jobqueue.hxx
+2
-3
threadpool.cxx
cppu/source/threadpool/threadpool.cxx
+8
-8
threadpool.hxx
cppu/source/threadpool/threadpool.hxx
+5
-2
No files found.
cppu/source/threadpool/jobqueue.cxx
Dosyayı görüntüle @
2861d5be
...
...
@@ -28,19 +28,11 @@ namespace cppu_threadpool {
JobQueue
::
JobQueue
()
:
m_nToDo
(
0
),
m_bSuspended
(
false
),
m_cndWait
(
osl_createCondition
()
)
m_bSuspended
(
false
)
{
osl_resetCondition
(
m_cndWait
);
m_DisposedCallerAdmin
=
DisposedCallerAdmin
::
getInstance
();
}
JobQueue
::~
JobQueue
()
{
osl_destroyCondition
(
m_cndWait
);
}
void
JobQueue
::
add
(
void
*
pThreadSpecificData
,
RequestFun
*
doRequest
)
{
MutexGuard
guard
(
m_mutex
);
...
...
@@ -48,7 +40,7 @@ namespace cppu_threadpool {
m_lstJob
.
push_back
(
job
);
if
(
!
m_bSuspended
)
{
osl_setCondition
(
m_cndWait
);
m_cndWait
.
set
(
);
}
m_nToDo
++
;
}
...
...
@@ -78,7 +70,7 @@ namespace cppu_threadpool {
}
}
osl_waitCondition
(
m_cndWait
,
0
);
m_cndWait
.
wait
(
);
struct
Job
job
=
{
0
,
0
};
{
...
...
@@ -92,7 +84,7 @@ namespace cppu_threadpool {
&&
(
m_lstCallstack
.
empty
()
||
m_lstCallstack
.
front
()
!=
0
)
)
{
osl_resetCondition
(
m_cndWait
);
m_cndWait
.
reset
(
);
}
break
;
}
...
...
@@ -106,7 +98,7 @@ namespace cppu_threadpool {
if
(
m_lstJob
.
empty
()
&&
(
m_lstCallstack
.
empty
()
||
m_lstCallstack
.
front
()
!=
0
)
)
{
osl_resetCondition
(
m_cndWait
);
m_cndWait
.
reset
(
);
}
}
...
...
@@ -150,7 +142,7 @@ namespace cppu_threadpool {
if
(
!
m_lstCallstack
.
empty
()
&&
!
m_lstCallstack
.
front
()
)
{
// The thread is waiting for a disposed pCallerId, let it go
osl_setCondition
(
m_cndWait
);
m_cndWait
.
set
(
);
}
}
...
...
@@ -166,7 +158,7 @@ namespace cppu_threadpool {
m_bSuspended
=
false
;
if
(
!
m_lstJob
.
empty
()
)
{
osl_setCondition
(
m_cndWait
);
m_cndWait
.
set
(
);
}
}
...
...
cppu/source/threadpool/jobqueue.hxx
Dosyayı görüntüle @
2861d5be
...
...
@@ -23,7 +23,7 @@
#include <list>
#include <sal/types.h>
#include <osl/conditn.h>
#include <osl/conditn.h
xx
>
#include <osl/mutex.hxx>
#include <boost/shared_ptr.hpp>
...
...
@@ -49,7 +49,6 @@ namespace cppu_threadpool
{
public
:
JobQueue
();
~
JobQueue
();
void
add
(
void
*
pThreadSpecificData
,
RequestFun
*
doRequest
);
...
...
@@ -69,7 +68,7 @@ namespace cppu_threadpool
CallStackList
m_lstCallstack
;
sal_Int32
m_nToDo
;
bool
m_bSuspended
;
oslCondition
m_cndWait
;
osl
::
Condition
m_cndWait
;
DisposedCallerAdminHolder
m_DisposedCallerAdmin
;
};
}
...
...
cppu/source/threadpool/threadpool.cxx
Dosyayı görüntüle @
2861d5be
...
...
@@ -39,6 +39,10 @@ using namespace ::rtl;
namespace
cppu_threadpool
{
WaitingThread
::
WaitingThread
(
rtl
::
Reference
<
ORequestThread
>
const
&
theThread
)
:
thread
(
theThread
)
{}
struct
theDisposedCallerAdmin
:
public
rtl
::
StaticWithInit
<
DisposedCallerAdminHolder
,
theDisposedCallerAdmin
>
{
...
...
@@ -138,9 +142,7 @@ namespace cppu_threadpool
******************/
void
ThreadPool
::
waitInPool
(
rtl
::
Reference
<
ORequestThread
>
const
&
pThread
)
{
struct
WaitingThread
waitingThread
;
waitingThread
.
condition
=
osl_createCondition
();
waitingThread
.
thread
=
pThread
;
WaitingThread
waitingThread
(
pThread
);
{
MutexGuard
guard
(
m_mutexWaitingThreadList
);
m_lstThreads
.
push_front
(
&
waitingThread
);
...
...
@@ -148,7 +150,7 @@ namespace cppu_threadpool
// let the thread wait 2 seconds
TimeValue
time
=
{
2
,
0
};
osl_waitCondition
(
waitingThread
.
condition
,
&
time
);
waitingThread
.
condition
.
wait
(
&
time
);
{
MutexGuard
guard
(
m_mutexWaitingThreadList
);
...
...
@@ -161,8 +163,6 @@ namespace cppu_threadpool
m_lstThreads
.
erase
(
ii
);
}
}
osl_destroyCondition
(
waitingThread
.
condition
);
}
void
ThreadPool
::
joinWorkers
()
...
...
@@ -174,7 +174,7 @@ namespace cppu_threadpool
++
ii
)
{
// wake the threads up
osl_setCondition
(
(
*
ii
)
->
condition
);
(
*
ii
)
->
condition
.
set
(
);
}
}
m_aThreadAdmin
.
join
();
...
...
@@ -198,7 +198,7 @@ namespace cppu_threadpool
m_lstThreads
.
pop_back
();
// let the thread go
osl_setCondition
(
pWaitingThread
->
condition
);
pWaitingThread
->
condition
.
set
(
);
return
true
;
}
}
...
...
cppu/source/threadpool/threadpool.hxx
Dosyayı görüntüle @
2861d5be
...
...
@@ -23,7 +23,7 @@
#include <list>
#include <unordered_map>
#include <osl/conditn.h>
#include <osl/conditn.h
xx
>
#include <rtl/byteseq.hxx>
#include <rtl/ref.hxx>
...
...
@@ -70,8 +70,11 @@ namespace cppu_threadpool {
struct
WaitingThread
{
oslCondition
condition
;
osl
::
Condition
condition
;
rtl
::
Reference
<
ORequestThread
>
thread
;
explicit
WaitingThread
(
rtl
::
Reference
<
ORequestThread
>
const
&
theThread
);
};
typedef
::
std
::
list
<
struct
::
cppu_threadpool
::
WaitingThread
*
>
WaitingThreadList
;
...
...
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