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
6297a9c4
Kaydet (Commit)
6297a9c4
authored
Eyl 30, 2011
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
generic: share sal yield mutex properly
üst
ef93683d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
178 deletions
+6
-178
Module_vcl.mk
vcl/Module_vcl.mk
+1
-1
svpinst.cxx
vcl/headless/svpinst.cxx
+3
-90
svpinst.hxx
vcl/inc/headless/svpinst.hxx
+1
-29
gtkinst.hxx
vcl/inc/unx/gtk/gtkinst.hxx
+1
-6
gtkinst.cxx
vcl/unx/gtk/app/gtkinst.cxx
+0
-52
No files found.
vcl/Module_vcl.mk
Dosyayı görüntüle @
6297a9c4
...
...
@@ -31,7 +31,6 @@ $(eval $(call gb_Module_Module,vcl))
$(eval $(call gb_Module_add_targets,vcl,\
Library_vcl \
Library_vclplug_svp \
StaticLibrary_vclmain \
Package_inc \
Package_afmhash \
...
...
@@ -40,6 +39,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
ifeq ($(GUIBASE),unx)
$(eval $(call gb_Module_add_targets,vcl,\
Library_vclplug_svp \
Library_vclplug_gen \
Library_desktop_detector \
))
...
...
vcl/headless/svpinst.cxx
Dosyayı görüntüle @
6297a9c4
...
...
@@ -53,7 +53,7 @@ extern "C"
{
SAL_DLLPUBLIC_EXPORT
SalInstance
*
create_SalInstance
()
{
SvpSalInstance
*
pInstance
=
new
SvpSalInstance
();
SvpSalInstance
*
pInstance
=
new
SvpSalInstance
(
new
SalYieldMutex
()
);
SalData
*
pSalData
=
new
SalData
();
pSalData
->
m_pInstance
=
pInstance
;
SetSalData
(
pSalData
);
...
...
@@ -77,8 +77,8 @@ bool SvpSalInstance::isFrameAlive( const SalFrame* pFrame ) const
SvpSalInstance
*
SvpSalInstance
::
s_pDefaultInstance
=
NULL
;
SvpSalInstance
::
SvpSalInstance
()
:
SalGenericInstance
(
new
SalYieldMutex
()
)
SvpSalInstance
::
SvpSalInstance
(
SalYieldMutex
*
pMutex
)
:
SalGenericInstance
(
pMutex
)
{
m_aTimeout
.
tv_sec
=
0
;
m_aTimeout
.
tv_usec
=
0
;
...
...
@@ -304,51 +304,6 @@ SalBitmap* SvpSalInstance::CreateSalBitmap()
return
new
SvpSalBitmap
();
}
osl
::
SolarMutex
*
SvpSalInstance
::
GetYieldMutex
()
{
return
&
m_aYieldMutex
;
}
sal_uLong
SvpSalInstance
::
ReleaseYieldMutex
()
{
if
(
m_aYieldMutex
.
GetThreadId
()
==
osl
::
Thread
::
getCurrentIdentifier
()
)
{
sal_uLong
nCount
=
m_aYieldMutex
.
GetAcquireCount
();
sal_uLong
n
=
nCount
;
while
(
n
)
{
m_aYieldMutex
.
release
();
n
--
;
}
return
nCount
;
}
else
return
0
;
}
void
SvpSalInstance
::
AcquireYieldMutex
(
sal_uLong
nCount
)
{
while
(
nCount
)
{
m_aYieldMutex
.
acquire
();
nCount
--
;
}
}
bool
SvpSalInstance
::
CheckYieldMutex
()
{
bool
bRet
=
true
;
if
(
m_aYieldMutex
.
GetThreadId
()
!=
::
osl
::
Thread
::
getCurrentIdentifier
()
)
{
bRet
=
false
;
}
return
bRet
;
}
void
SvpSalInstance
::
Yield
(
bool
bWait
,
bool
bHandleAllCurrentEvents
)
{
// first, check for already queued events.
...
...
@@ -453,48 +408,6 @@ void* SvpSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturn
return
const_cast
<
char
*>
(
""
);
}
// -------------------------------------------------------------------------
//
// SalYieldMutex
//
// -------------------------------------------------------------------------
SvpSalYieldMutex
::
SvpSalYieldMutex
()
{
mnCount
=
0
;
mnThreadId
=
0
;
}
void
SvpSalYieldMutex
::
acquire
()
{
SolarMutexObject
::
acquire
();
mnThreadId
=
osl
::
Thread
::
getCurrentIdentifier
();
mnCount
++
;
}
void
SvpSalYieldMutex
::
release
()
{
if
(
mnThreadId
==
osl
::
Thread
::
getCurrentIdentifier
()
)
{
if
(
mnCount
==
1
)
mnThreadId
=
0
;
mnCount
--
;
}
SolarMutexObject
::
release
();
}
sal_Bool
SvpSalYieldMutex
::
tryToAcquire
()
{
if
(
SolarMutexObject
::
tryToAcquire
()
)
{
mnThreadId
=
osl
::
Thread
::
getCurrentIdentifier
();
mnCount
++
;
return
sal_True
;
}
else
return
sal_False
;
}
// ---------------
// - SalTimer -
// ---------------
...
...
vcl/inc/headless/svpinst.hxx
Dosyayı görüntüle @
6297a9c4
...
...
@@ -46,27 +46,6 @@
#define VIRTUAL_DESKTOP_HEIGHT 768
#define VIRTUAL_DESKTOP_DEPTH 24
// -------------------------------------------------------------------------
// SalYieldMutex
// -------------------------------------------------------------------------
class
SvpSalYieldMutex
:
public
::
vcl
::
SolarMutexObject
{
protected
:
sal_uLong
mnCount
;
oslThreadIdentifier
mnThreadId
;
public
:
SvpSalYieldMutex
();
virtual
void
acquire
();
virtual
void
release
();
virtual
sal_Bool
tryToAcquire
();
sal_uLong
GetAcquireCount
()
const
{
return
mnCount
;
}
oslThreadIdentifier
GetThreadId
()
const
{
return
mnThreadId
;
}
};
// ---------------
// - SalTimer -
// ---------------
...
...
@@ -92,7 +71,6 @@ class SvpSalInstance : public SalGenericInstance
timeval
m_aTimeout
;
sal_uLong
m_nTimeoutMS
;
int
m_pTimeoutFDS
[
2
];
SvpSalYieldMutex
m_aYieldMutex
;
// internal event queue
struct
SalUserEvent
...
...
@@ -118,7 +96,7 @@ class SvpSalInstance : public SalGenericInstance
public
:
static
SvpSalInstance
*
s_pDefaultInstance
;
SvpSalInstance
();
SvpSalInstance
(
SalYieldMutex
*
pMutex
);
virtual
~
SvpSalInstance
();
void
PostEvent
(
const
SalFrame
*
pFrame
,
void
*
pData
,
sal_uInt16
nEvent
);
...
...
@@ -177,12 +155,6 @@ public:
// SalBitmap
virtual
SalBitmap
*
CreateSalBitmap
();
// YieldMutex
virtual
osl
::
SolarMutex
*
GetYieldMutex
();
virtual
sal_uLong
ReleaseYieldMutex
();
virtual
void
AcquireYieldMutex
(
sal_uLong
nCount
);
virtual
bool
CheckYieldMutex
();
// wait next event and dispatch
// must returned by UserEvent (SalFrame::PostEvent)
// and timer
...
...
vcl/inc/unx/gtk/gtkinst.hxx
Dosyayı görüntüle @
6297a9c4
...
...
@@ -82,10 +82,9 @@ public:
#if GTK_CHECK_VERSION(3,0,0)
class
GtkInstance
:
public
SvpSalInstance
{
SalYieldMutex
*
mpSalYieldMutex
;
public
:
GtkInstance
(
SalYieldMutex
*
pMutex
)
:
SvpSalInstance
(
),
mpSalYieldMutex
(
pMutex
)
:
SvpSalInstance
(
pMutex
)
#else
class
GtkInstance
:
public
X11SalInstance
{
...
...
@@ -108,10 +107,6 @@ public:
const
SystemGraphicsData
*
);
virtual
SalBitmap
*
CreateSalBitmap
();
virtual
osl
::
SolarMutex
*
GetYieldMutex
();
virtual
sal_uIntPtr
ReleaseYieldMutex
();
virtual
void
AcquireYieldMutex
(
sal_uIntPtr
nCount
);
virtual
bool
CheckYieldMutex
();
virtual
void
Yield
(
bool
bWait
,
bool
bHandleAllCurrentEvents
);
virtual
bool
AnyInput
(
sal_uInt16
nType
);
};
...
...
vcl/unx/gtk/app/gtkinst.cxx
Dosyayı görüntüle @
6297a9c4
...
...
@@ -443,59 +443,7 @@ SalBitmap* GtkInstance::CreateSalBitmap()
SalTimer
*
GtkInstance
::
CreateSalTimer
()
{
#if GTK_CHECK_VERSION(3,0,0)
return
new
GtkSalTimer
();
#else
return
X11SalInstance
::
CreateSalTimer
();
#endif
}
// FIXME: these should all be in a more generic, shared base of unix's salinst.cxx
osl
::
SolarMutex
*
GtkInstance
::
GetYieldMutex
()
{
return
mpSalYieldMutex
;
}
sal_uIntPtr
GtkInstance
::
ReleaseYieldMutex
()
{
SalYieldMutex
*
pYieldMutex
=
mpSalYieldMutex
;
if
(
pYieldMutex
->
GetThreadId
()
==
osl
::
Thread
::
getCurrentIdentifier
()
)
{
sal_uLong
nCount
=
pYieldMutex
->
GetAcquireCount
();
sal_uLong
n
=
nCount
;
while
(
n
)
{
pYieldMutex
->
release
();
n
--
;
}
return
nCount
;
}
else
return
0
;
}
void
GtkInstance
::
AcquireYieldMutex
(
sal_uIntPtr
nCount
)
{
SalYieldMutex
*
pYieldMutex
=
mpSalYieldMutex
;
while
(
nCount
)
{
pYieldMutex
->
acquire
();
nCount
--
;
}
}
bool
GtkInstance
::
CheckYieldMutex
()
{
bool
bRet
=
true
;
SalYieldMutex
*
pYieldMutex
=
mpSalYieldMutex
;
if
(
pYieldMutex
->
GetThreadId
()
!=
osl
::
Thread
::
getCurrentIdentifier
()
)
bRet
=
false
;
return
bRet
;
}
void
GtkInstance
::
Yield
(
bool
bWait
,
bool
bHandleAllCurrentEvents
)
...
...
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