Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
PolyORB-HI-C
Commits
4b6d8c81
Commit
4b6d8c81
authored
May 28, 2018
by
Antonia Francis
Browse files
* Adjust semantics for pthread_mutex_trylock()
parent
f3931276
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/po_hi_semaphore.c
View file @
4b6d8c81
...
...
@@ -115,11 +115,10 @@ int __po_hi_sem_wait(__po_hi_sem_t* sem)
{
#if defined (RTEMS_POSIX) || defined (POSIX) || defined (XENO_POSIX)
/* Locking the mutex */
if
(
pthread_mutex_trylock
(
&
sem
->
mutex
.
posix_mutex
)
!=
0
)
{
__PO_HI_DEBUG_CRITICAL
(
"[SEMAPHORE] Error when trying to trylock mutex
\n
"
);
return
__PO_HI_ERROR_SEM_WAIT
;
if
(
pthread_mutex_trylock
(
&
sem
->
mutex
.
posix_mutex
)
==
0
)
{
pthread_mutex_lock
(
&
sem
->
mutex
.
posix_mutex
);
}
/* Waiting on a condition and unlocking the mutex while doing so */
if
(
pthread_cond_wait
(
&
sem
->
posix_condvar
,
&
sem
->
mutex
.
posix_mutex
)
!=
0
)
{
...
...
@@ -168,6 +167,7 @@ int __po_hi_sem_wait(__po_hi_sem_t* sem)
EnterCriticalSection
(
&
sem
->
win32_criticalsection
);
#endif
return
__PO_HI_SUCCESS
;
}
...
...
Write
Preview
Supports
Markdown
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