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
89940633
Kaydet (Commit)
89940633
authored
Agu 28, 2014
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
replace sleep with two condition variables
Change-Id: I7611b5be7d462646a19ebfd86b8d6612dccafc71
üst
01a4949d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
8 deletions
+45
-8
GL3DBarChart.cxx
chart2/source/view/charttypes/GL3DBarChart.cxx
+35
-8
GL3DBarChart.hxx
chart2/source/view/inc/GL3DBarChart.hxx
+10
-0
No files found.
chart2/source/view/charttypes/GL3DBarChart.cxx
Dosyayı görüntüle @
89940633
...
...
@@ -79,6 +79,27 @@ double findMaxValue(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer)
return
nMax
;
}
class
SharedResourceAccess
{
private
:
osl
::
Condition
&
mrCond1
;
osl
::
Condition
&
mrCond2
;
public
:
SharedResourceAccess
(
osl
::
Condition
&
rCond1
,
osl
::
Condition
&
rCond2
)
:
mrCond1
(
rCond1
),
mrCond2
(
rCond2
)
{
mrCond1
.
set
();
}
~
SharedResourceAccess
()
{
mrCond2
.
set
();
}
};
}
class
RenderThread
:
public
salhelper
::
Thread
...
...
@@ -418,6 +439,7 @@ void RenderBenchMarkThread::execute()
{
{
osl
::
MutexGuard
aGuard
(
mpChart
->
maMutex
);
mpChart
->
maCond2
.
reset
();
if
(
mpChart
->
mbRenderDie
)
break
;
UpdateScreenText
();
...
...
@@ -425,14 +447,11 @@ void RenderBenchMarkThread::execute()
renderFrame
();
mpChart
->
miFrameCount
++
;
}
#ifdef WNT
Sleep
(
1
);
#else
TimeValue
nTV
;
nTV
.
Seconds
=
0
;
nTV
.
Nanosec
=
1000000
;
osl_waitThread
(
&
nTV
);
#endif
if
(
mpChart
->
maCond1
.
check
())
{
mpChart
->
maCond1
.
reset
();
mpChart
->
maCond2
.
wait
();
}
}
}
...
...
@@ -517,6 +536,7 @@ GL3DBarChart::~GL3DBarChart()
{
if
(
mbBenchMarkMode
)
{
SharedResourceAccess
(
maCond1
,
maCond2
);
osl
::
MutexGuard
aGuard
(
maMutex
);
mbRenderDie
=
true
;
}
...
...
@@ -531,6 +551,7 @@ GL3DBarChart::~GL3DBarChart()
void
GL3DBarChart
::
create3DShapes
(
const
boost
::
ptr_vector
<
VDataSeries
>&
rDataSeriesContainer
,
ExplicitCategoriesProvider
&
rCatProvider
)
{
SharedResourceAccess
(
maCond1
,
maCond2
);
osl
::
MutexGuard
aGuard
(
maMutex
);
mpRenderer
->
ReleaseShapes
();
// Each series of data flows from left to right, and multiple series are
...
...
@@ -803,6 +824,7 @@ void GL3DBarChart::moveToDefault()
return
;
{
SharedResourceAccess
(
maCond1
,
maCond2
);
osl
::
MutexGuard
aGuard
(
maMutex
);
maRenderEvent
=
EVENT_MOVE_TO_DEFAULT
;
}
...
...
@@ -845,6 +867,7 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
return
;
{
SharedResourceAccess
(
maCond1
,
maCond2
);
osl
::
MutexGuard
aGuard
(
maMutex
);
maClickPos
=
rPos
;
mnPreSelectBarId
=
mnSelectBarId
;
...
...
@@ -913,6 +936,7 @@ void GL3DBarChart::render()
void
GL3DBarChart
::
mouseDragMove
(
const
Point
&
rStartPos
,
const
Point
&
rEndPos
,
sal_uInt16
)
{
long
nDirection
=
rEndPos
.
X
()
-
rStartPos
.
X
();
SharedResourceAccess
(
maCond1
,
maCond2
);
osl
::
MutexGuard
aGuard
(
maMutex
);
if
((
maRenderEvent
==
EVENT_NONE
)
||
(
maRenderEvent
==
EVENT_SHOW_SCROLL
)
||
(
maRenderEvent
==
EVENT_AUTO_FLY
)
||
(
maRenderEvent
==
EVENT_SHOW_SELECT
))
...
...
@@ -989,6 +1013,7 @@ void GL3DBarChart::moveToCorner()
void
GL3DBarChart
::
scroll
(
long
nDelta
)
{
{
SharedResourceAccess
(
maCond1
,
maCond2
);
osl
::
MutexGuard
aGuard
(
maMutex
);
if
((
maRenderEvent
!=
EVENT_NONE
)
&&
(
maRenderEvent
!=
EVENT_SHOW_SCROLL
)
&&
(
maRenderEvent
!=
EVENT_AUTO_FLY
)
&&
(
maRenderEvent
==
EVENT_SHOW_SELECT
))
...
...
@@ -1009,6 +1034,7 @@ void GL3DBarChart::scroll(long nDelta)
void
GL3DBarChart
::
contextDestroyed
()
{
SharedResourceAccess
(
maCond1
,
maCond2
);
osl
::
MutexGuard
aGuard
(
maMutex
);
mbValidContext
=
false
;
}
...
...
@@ -1055,6 +1081,7 @@ int GL3DBarChart::calcTimeInterval(TimeValue &startTime, TimeValue &endTime)
void
GL3DBarChart
::
updateScreenText
()
{
SharedResourceAccess
(
maCond1
,
maCond2
);
osl
::
MutexGuard
aGuard
(
maMutex
);
maScreenTextShapes
.
clear
();
mpRenderer
->
ReleaseScreenTextShapes
();
...
...
chart2/source/view/inc/GL3DBarChart.hxx
Dosyayı görüntüle @
89940633
...
...
@@ -181,6 +181,16 @@ private:
int
mnColorRate
;
bool
mbBenchMarkMode
;
sal_uInt32
maHistoryCounter
;
// these form a pair:
// main thread sets condition 1 and waits until it can take the mutex
// render thread checks condition 1 before taking the mutex and waits in case it
// is set until condition 2 is set
//
// only necessary for the benchmark mode
osl
::
Condition
maCond1
;
osl
::
Condition
maCond2
;
};
}
...
...
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