summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/semgetvalue.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/posix/src/semgetvalue.c')
-rw-r--r--cpukit/posix/src/semgetvalue.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/cpukit/posix/src/semgetvalue.c b/cpukit/posix/src/semgetvalue.c
index 63e3823dff..1b752944fa 100644
--- a/cpukit/posix/src/semgetvalue.c
+++ b/cpukit/posix/src/semgetvalue.c
@@ -28,20 +28,21 @@ int sem_getvalue(
)
{
POSIX_Semaphore_Control *the_semaphore;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
- the_semaphore = _POSIX_Semaphore_Get( sem, &lock_context );
+ the_semaphore = _POSIX_Semaphore_Get( sem, &queue_context );
if ( the_semaphore == NULL ) {
rtems_set_errno_and_return_minus_one( EINVAL );
}
- /*
- * Assume a relaxed atomic load of the value on SMP configurations.
- * Thus, there is no need to acquire a lock.
- */
+ _CORE_semaphore_Acquire_critical(
+ &the_semaphore->Semaphore,
+ &queue_context
+ );
+
*sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
- _ISR_lock_ISR_enable( &lock_context );
+ _CORE_semaphore_Release( &the_semaphore->Semaphore, &queue_context );
return 0;
}