summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-01 20:52:51 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-19 12:00:46 +0200
commite76c517d0726f91447e0e2c3ba14c00896456e89 (patch)
treecaa429239407c3cfa4cfd8a4e68aae25e893ca35 /cpukit/posix
parentscore: Fine grained locking for message queues (diff)
downloadrtems-e76c517d0726f91447e0e2c3ba14c00896456e89.tar.bz2
score: Fine grained locking for semaphores
Update #2273.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/include/rtems/posix/semaphoreimpl.h14
-rw-r--r--cpukit/posix/src/sempost.c13
2 files changed, 23 insertions, 4 deletions
diff --git a/cpukit/posix/include/rtems/posix/semaphoreimpl.h b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
index 783289aa44..eeea51c488 100644
--- a/cpukit/posix/include/rtems/posix/semaphoreimpl.h
+++ b/cpukit/posix/include/rtems/posix/semaphoreimpl.h
@@ -89,6 +89,20 @@ RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
_Objects_Get( &_POSIX_Semaphore_Information, (Objects_Id)*id, location );
}
+RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *
+_POSIX_Semaphore_Get_interrupt_disable(
+ sem_t *id,
+ Objects_Locations *location,
+ ISR_lock_Context *lock_context
+)
+{
+ return (POSIX_Semaphore_Control *) _Objects_Get_isr_disable(
+ &_POSIX_Semaphore_Information,
+ (Objects_Id)*id,
+ location,
+ lock_context
+ );
+}
/**
* @brief POSIX Semaphore Create Support
diff --git a/cpukit/posix/src/sempost.c b/cpukit/posix/src/sempost.c
index f139c9ab67..9c8c673ddb 100644
--- a/cpukit/posix/src/sempost.c
+++ b/cpukit/posix/src/sempost.c
@@ -37,8 +37,13 @@ int sem_post(
{
POSIX_Semaphore_Control *the_semaphore;
Objects_Locations location;
+ ISR_lock_Context lock_context;
- the_semaphore = _POSIX_Semaphore_Get( sem, &location );
+ the_semaphore = _POSIX_Semaphore_Get_interrupt_disable(
+ sem,
+ &location,
+ &lock_context
+ );
switch ( location ) {
case OBJECTS_LOCAL:
@@ -46,12 +51,12 @@ int sem_post(
&the_semaphore->Semaphore,
the_semaphore->Object.id,
#if defined(RTEMS_MULTIPROCESSING)
- NULL /* POSIX Semaphores are local only */
+ NULL, /* POSIX Semaphores are local only */
#else
- NULL
+ NULL,
#endif
+ &lock_context
);
- _Objects_Put( &the_semaphore->Object );
return 0;
#if defined(RTEMS_MULTIPROCESSING)