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
2dede8bf
Kaydet (Commit)
2dede8bf
authored
Nis 09, 2015
tarafından
Tor Lillqvist
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Change from <osl/diagnose.h> to <sal/log.hxx> and add more logging
Change-Id: Iee8c093f5aa8306c3e5336d6dd5e801df6df87a4
üst
04a98015
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
23 deletions
+25
-23
mutex.cxx
sal/osl/unx/mutex.cxx
+25
-23
No files found.
sal/osl/unx/mutex.cxx
Dosyayı görüntüle @
2dede8bf
...
...
@@ -25,8 +25,8 @@
#endif
#include "system.hxx"
#include <sal/log.hxx>
#include <osl/mutex.h>
#include <osl/diagnose.h>
#include <pthread.h>
#include <stdlib.h>
...
...
@@ -37,16 +37,13 @@ typedef struct _oslMutexImpl
pthread_mutex_t
mutex
;
}
oslMutexImpl
;
/*****************************************************************************/
/* osl_createMutex */
/*****************************************************************************/
oslMutex
SAL_CALL
osl_createMutex
()
{
oslMutexImpl
*
pMutex
=
static_cast
<
oslMutexImpl
*>
(
malloc
(
sizeof
(
oslMutexImpl
)));
pthread_mutexattr_t
aMutexAttr
;
int
nRet
=
0
;
OSL_ASSERT
(
pMutex
);
SAL_WARN_IF
(
!
pMutex
,
"sal.osl.mutex"
,
"null pMutex"
);
if
(
pMutex
==
0
)
{
...
...
@@ -60,8 +57,7 @@ oslMutex SAL_CALL osl_createMutex()
nRet
=
pthread_mutex_init
(
&
(
pMutex
->
mutex
),
&
aMutexAttr
);
if
(
nRet
!=
0
)
{
OSL_TRACE
(
"osl_createMutex : mutex init/setattr failed. Errno: %d; %s
\n
"
,
nRet
,
strerror
(
nRet
));
SAL_WARN
(
"sal.osl.mutex"
,
"pthread_muxex_init failed: "
<<
strerror
(
nRet
));
free
(
pMutex
);
pMutex
=
0
;
...
...
@@ -69,12 +65,16 @@ oslMutex SAL_CALL osl_createMutex()
pthread_mutexattr_destroy
(
&
aMutexAttr
);
SAL_INFO
(
"sal.osl.mutex"
,
"osl_createMutex(): "
<<
pMutex
);
return
pMutex
;
}
void
SAL_CALL
osl_destroyMutex
(
oslMutexImpl
*
pMutex
)
{
OSL_ASSERT
(
pMutex
);
SAL_WARN_IF
(
!
pMutex
,
"sal.osl.mutex"
,
"null pMutex"
);
SAL_INFO
(
"sal.osl.mutex"
,
"osl_destroyMutex("
<<
pMutex
<<
")"
);
if
(
pMutex
!=
0
)
{
...
...
@@ -83,8 +83,7 @@ void SAL_CALL osl_destroyMutex(oslMutexImpl *pMutex)
nRet
=
pthread_mutex_destroy
(
&
(
pMutex
->
mutex
));
if
(
nRet
!=
0
)
{
OSL_TRACE
(
"osl_destroyMutex : mutex destroy failed. Errno: %d; %s
\n
"
,
nRet
,
strerror
(
nRet
));
SAL_WARN
(
"sal.osl.mutex"
,
"pthread_mutex_destroy failed: "
<<
strerror
(
nRet
));
}
free
(
pMutex
);
...
...
@@ -95,7 +94,9 @@ void SAL_CALL osl_destroyMutex(oslMutexImpl *pMutex)
sal_Bool
SAL_CALL
osl_acquireMutex
(
oslMutexImpl
*
pMutex
)
{
OSL_ASSERT
(
pMutex
);
SAL_WARN_IF
(
!
pMutex
,
"sal.osl.mutex"
,
"null pMutex"
);
SAL_INFO
(
"sal.osl.mutex"
,
"osl_acquireMutex("
<<
pMutex
<<
")"
);
if
(
pMutex
!=
0
)
{
...
...
@@ -104,8 +105,7 @@ sal_Bool SAL_CALL osl_acquireMutex(oslMutexImpl *pMutex)
nRet
=
pthread_mutex_lock
(
&
(
pMutex
->
mutex
));
if
(
nRet
!=
0
)
{
OSL_TRACE
(
"osl_acquireMutex : mutex lock failed. Errno: %d; %s
\n
"
,
nRet
,
strerror
(
nRet
));
SAL_WARN
(
"sal.osl.mutex"
,
"pthread_mutex_lock failed: "
<<
strerror
(
nRet
));
return
sal_False
;
}
return
sal_True
;
...
...
@@ -117,25 +117,28 @@ sal_Bool SAL_CALL osl_acquireMutex(oslMutexImpl *pMutex)
sal_Bool
SAL_CALL
osl_tryToAcquireMutex
(
oslMutexImpl
*
pMutex
)
{
OSL_ASSERT
(
pMutex
);
sal_Bool
result
=
sal_False
;
SAL_WARN_IF
(
!
pMutex
,
"sal.osl.mutex"
,
"null pMutex"
);
if
(
pMutex
)
{
int
nRet
=
0
;
nRet
=
pthread_mutex_trylock
(
&
(
pMutex
->
mutex
));
if
(
nRet
!=
0
)
return
sal_False
;
return
sal_True
;
if
(
nRet
==
0
)
result
=
sal_True
;
}
/* not initialized */
return
sal_False
;
SAL_INFO
(
"sal.osl.mutex"
,
"osl_tryToAcquireMutex("
<<
pMutex
<<
"): "
<<
(
result
?
"YES"
:
"NO"
));
return
result
;
}
sal_Bool
SAL_CALL
osl_releaseMutex
(
oslMutexImpl
*
pMutex
)
{
OSL_ASSERT
(
pMutex
);
SAL_WARN_IF
(
!
pMutex
,
"sal.osl.mutex"
,
"null pMutex"
);
SAL_INFO
(
"sal.osl.mutex"
,
"osl_releaseMutex("
<<
pMutex
<<
")"
);
if
(
pMutex
)
{
...
...
@@ -143,8 +146,7 @@ sal_Bool SAL_CALL osl_releaseMutex(oslMutexImpl *pMutex)
nRet
=
pthread_mutex_unlock
(
&
(
pMutex
->
mutex
));
if
(
nRet
!=
0
)
{
OSL_TRACE
(
"osl_releaseMutex : mutex unlock failed. Errno: %d; %s
\n
"
,
nRet
,
strerror
(
nRet
));
SAL_WARN
(
"sal.osl.mutex"
,
"pthread_mutex_unlock failed: "
<<
strerror
(
nRet
));
return
sal_False
;
}
...
...
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