summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-23 11:40:18 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-25 12:43:54 +0200
commit631b3c8967a329cdd53e54365e4e4c0aa93a4251 (patch)
tree3a750b145a90c90aa86222c26ee68aeb8c87a417 /cpukit/posix/src
parentscore: Get rid of mp_id parameter (diff)
downloadrtems-631b3c8967a329cdd53e54365e4e4c0aa93a4251.tar.bz2
score: Move thread queue MP callout to context
Drop the multiprocessing (MP) dependent callout parameter from the thread queue extract, dequeue, flush and unblock methods. Merge this parameter with the lock context into new structure Thread_queue_Context. This helps to gets rid of the conditionally compiled method call helpers.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r--cpukit/posix/src/conddestroy.c10
-rw-r--r--cpukit/posix/src/condget.c6
-rw-r--r--cpukit/posix/src/condsignalsupp.c11
-rw-r--r--cpukit/posix/src/condwaitsupp.c21
-rw-r--r--cpukit/posix/src/mqueueclose.c10
-rw-r--r--cpukit/posix/src/mqueuedeletesupp.c10
-rw-r--r--cpukit/posix/src/mqueuegetattr.c10
-rw-r--r--cpukit/posix/src/mqueuenotify.c16
-rw-r--r--cpukit/posix/src/mqueuerecvsupp.c14
-rw-r--r--cpukit/posix/src/mqueuesendsupp.c13
-rw-r--r--cpukit/posix/src/mqueuesetattr.c10
-rw-r--r--cpukit/posix/src/mqueueunlink.c6
-rw-r--r--cpukit/posix/src/mutexdestroy.c14
-rw-r--r--cpukit/posix/src/mutexget.c6
-rw-r--r--cpukit/posix/src/mutexgetprioceiling.c10
-rw-r--r--cpukit/posix/src/mutexlocksupp.c10
-rw-r--r--cpukit/posix/src/mutexsetprioceiling.c7
-rw-r--r--cpukit/posix/src/mutexunlock.c14
-rw-r--r--cpukit/posix/src/pbarrierdestroy.c10
-rw-r--r--cpukit/posix/src/pbarrierwait.c7
-rw-r--r--cpukit/posix/src/prwlockdestroy.c10
-rw-r--r--cpukit/posix/src/prwlockinit.c6
-rw-r--r--cpukit/posix/src/prwlockrdlock.c6
-rw-r--r--cpukit/posix/src/prwlocktimedrdlock.c6
-rw-r--r--cpukit/posix/src/prwlocktimedwrlock.c6
-rw-r--r--cpukit/posix/src/prwlocktryrdlock.c6
-rw-r--r--cpukit/posix/src/prwlocktrywrlock.c6
-rw-r--r--cpukit/posix/src/prwlockunlock.c6
-rw-r--r--cpukit/posix/src/prwlockwrlock.c6
-rw-r--r--cpukit/posix/src/semaphoredeletesupp.c10
-rw-r--r--cpukit/posix/src/semaphorewaitsupp.c6
-rw-r--r--cpukit/posix/src/semclose.c8
-rw-r--r--cpukit/posix/src/semdestroy.c10
-rw-r--r--cpukit/posix/src/semgetvalue.c15
-rw-r--r--cpukit/posix/src/sempost.c7
-rw-r--r--cpukit/posix/src/semunlink.c8
36 files changed, 160 insertions, 177 deletions
diff --git a/cpukit/posix/src/conddestroy.c b/cpukit/posix/src/conddestroy.c
index d47c6b2bed..a2c8dc188f 100644
--- a/cpukit/posix/src/conddestroy.c
+++ b/cpukit/posix/src/conddestroy.c
@@ -29,20 +29,20 @@ int pthread_cond_destroy(
)
{
POSIX_Condition_variables_Control *the_cond;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
_Objects_Allocator_lock();
- the_cond = _POSIX_Condition_variables_Get( cond, &lock_context );
+ the_cond = _POSIX_Condition_variables_Get( cond, &queue_context );
if ( the_cond == NULL ) {
_Objects_Allocator_unlock();
return EINVAL;
}
- _POSIX_Condition_variables_Acquire_critical( the_cond, &lock_context );
+ _POSIX_Condition_variables_Acquire_critical( the_cond, &queue_context );
if ( !_Thread_queue_Is_empty( &the_cond->Wait_queue.Queue ) ) {
- _POSIX_Condition_variables_Release( the_cond, &lock_context );
+ _POSIX_Condition_variables_Release( the_cond, &queue_context );
_Objects_Allocator_unlock();
return EBUSY;
}
@@ -51,7 +51,7 @@ int pthread_cond_destroy(
&_POSIX_Condition_variables_Information,
&the_cond->Object
);
- _POSIX_Condition_variables_Release( the_cond, &lock_context );
+ _POSIX_Condition_variables_Release( the_cond, &queue_context );
_POSIX_Condition_variables_Destroy( the_cond );
_POSIX_Condition_variables_Free( the_cond );
_Objects_Allocator_unlock();
diff --git a/cpukit/posix/src/condget.c b/cpukit/posix/src/condget.c
index 5676de861a..5b086ef7c9 100644
--- a/cpukit/posix/src/condget.c
+++ b/cpukit/posix/src/condget.c
@@ -15,14 +15,14 @@
#include <rtems/posix/posixapi.h>
POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get(
- pthread_cond_t *cond,
- ISR_lock_Context *lock_context
+ pthread_cond_t *cond,
+ Thread_queue_Context *queue_context
)
{
_POSIX_Get_object_body(
POSIX_Condition_variables_Control,
cond,
- lock_context,
+ queue_context,
&_POSIX_Condition_variables_Information,
PTHREAD_COND_INITIALIZER,
pthread_cond_init
diff --git a/cpukit/posix/src/condsignalsupp.c b/cpukit/posix/src/condsignalsupp.c
index 38aa053f9f..e42476e1c4 100644
--- a/cpukit/posix/src/condsignalsupp.c
+++ b/cpukit/posix/src/condsignalsupp.c
@@ -36,15 +36,15 @@ int _POSIX_Condition_variables_Signal_support(
do {
POSIX_Condition_variables_Control *the_cond;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
- the_cond = _POSIX_Condition_variables_Get( cond, &lock_context );
+ the_cond = _POSIX_Condition_variables_Get( cond, &queue_context );
if ( the_cond == NULL ) {
return EINVAL;
}
- _POSIX_Condition_variables_Acquire_critical( the_cond, &lock_context );
+ _POSIX_Condition_variables_Acquire_critical( the_cond, &queue_context );
the_thread = _Thread_queue_First_locked(
&the_cond->Wait_queue,
@@ -56,12 +56,11 @@ int _POSIX_Condition_variables_Signal_support(
&the_cond->Wait_queue.Queue,
POSIX_CONDITION_VARIABLES_TQ_OPERATIONS,
the_thread,
- NULL,
- &lock_context
+ &queue_context
);
} else {
the_cond->mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
- _POSIX_Condition_variables_Release( the_cond, &lock_context );
+ _POSIX_Condition_variables_Release( the_cond, &queue_context );
}
} while ( is_broadcast && the_thread != NULL );
diff --git a/cpukit/posix/src/condwaitsupp.c b/cpukit/posix/src/condwaitsupp.c
index 11b05872f3..4e89ef0b50 100644
--- a/cpukit/posix/src/condwaitsupp.c
+++ b/cpukit/posix/src/condwaitsupp.c
@@ -35,7 +35,7 @@ int _POSIX_Condition_variables_Wait_support(
{
POSIX_Condition_variables_Control *the_cond;
POSIX_Mutex_Control *the_mutex;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
int status;
int mutex_status;
CORE_mutex_Status core_mutex_status;
@@ -46,25 +46,25 @@ int _POSIX_Condition_variables_Wait_support(
return EINVAL;
}
- the_cond = _POSIX_Condition_variables_Get( cond, &lock_context );
+ the_cond = _POSIX_Condition_variables_Get( cond, &queue_context );
if ( the_cond == NULL ) {
return EINVAL;
}
- _POSIX_Condition_variables_Acquire_critical( the_cond, &lock_context );
+ _POSIX_Condition_variables_Acquire_critical( the_cond, &queue_context );
if (
the_cond->mutex != POSIX_CONDITION_VARIABLES_NO_MUTEX
&& the_cond->mutex != *mutex
) {
- _POSIX_Condition_variables_Release( the_cond, &lock_context );
+ _POSIX_Condition_variables_Release( the_cond, &queue_context );
return EINVAL;
}
the_cond->mutex = *mutex;
- cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
+ cpu_self = _Thread_Dispatch_disable_critical( &queue_context.Lock_context );
executing = _Per_CPU_Get_executing( cpu_self );
/*
@@ -78,7 +78,7 @@ int _POSIX_Condition_variables_Wait_support(
the_mutex == NULL
|| !_CORE_mutex_Is_owner( &the_mutex->Mutex, executing )
) {
- _POSIX_Condition_variables_Release( the_cond, &lock_context );
+ _POSIX_Condition_variables_Release( the_cond, &queue_context );
_Thread_Dispatch_enable( cpu_self );
return EPERM;
}
@@ -92,18 +92,17 @@ int _POSIX_Condition_variables_Wait_support(
STATES_WAITING_FOR_CONDITION_VARIABLE,
timeout,
ETIMEDOUT,
- &lock_context
+ &queue_context.Lock_context
);
} else {
- _POSIX_Condition_variables_Release( the_cond, &lock_context );
+ _POSIX_Condition_variables_Release( the_cond, &queue_context );
executing->Wait.return_code = ETIMEDOUT;
}
- _ISR_lock_ISR_disable( &lock_context );
+ _ISR_lock_ISR_disable( &queue_context.Lock_context );
core_mutex_status = _CORE_mutex_Surrender(
&the_mutex->Mutex,
- NULL,
- &lock_context
+ &queue_context
);
_Assert( core_mutex_status == CORE_MUTEX_STATUS_SUCCESSFUL );
(void) core_mutex_status;
diff --git a/cpukit/posix/src/mqueueclose.c b/cpukit/posix/src/mqueueclose.c
index 28a7d164d9..60d3ce3ea9 100644
--- a/cpukit/posix/src/mqueueclose.c
+++ b/cpukit/posix/src/mqueueclose.c
@@ -42,10 +42,10 @@ int mq_close(
)
{
POSIX_Message_queue_Control *the_mq;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
_Objects_Allocator_lock();
- the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
+ the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
if ( the_mq == NULL ) {
_Objects_Allocator_unlock();
@@ -54,17 +54,17 @@ int mq_close(
_CORE_message_queue_Acquire_critical(
&the_mq->Message_queue,
- &lock_context
+ &queue_context
);
if ( the_mq->open_count == 0 ) {
- _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
_Objects_Allocator_unlock();
rtems_set_errno_and_return_minus_one( EBADF );
}
the_mq->open_count -= 1;
- _POSIX_Message_queue_Delete( the_mq, &lock_context );
+ _POSIX_Message_queue_Delete( the_mq, &queue_context );
_Objects_Allocator_unlock();
return 0;
diff --git a/cpukit/posix/src/mqueuedeletesupp.c b/cpukit/posix/src/mqueuedeletesupp.c
index 485136c864..850707a0d9 100644
--- a/cpukit/posix/src/mqueuedeletesupp.c
+++ b/cpukit/posix/src/mqueuedeletesupp.c
@@ -22,17 +22,13 @@
void _POSIX_Message_queue_Delete(
POSIX_Message_queue_Control *the_mq,
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
if ( !the_mq->linked && the_mq->open_count == 0 ) {
- _CORE_message_queue_Close(
- &the_mq->Message_queue,
- NULL, /* no MP support */
- lock_context
- );
+ _CORE_message_queue_Close( &the_mq->Message_queue, queue_context );
_POSIX_Message_queue_Free( the_mq );
} else {
- _CORE_message_queue_Release( &the_mq->Message_queue, lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, queue_context );
}
}
diff --git a/cpukit/posix/src/mqueuegetattr.c b/cpukit/posix/src/mqueuegetattr.c
index dae14e3f2e..5efcc0b154 100644
--- a/cpukit/posix/src/mqueuegetattr.c
+++ b/cpukit/posix/src/mqueuegetattr.c
@@ -42,13 +42,13 @@ int mq_getattr(
)
{
POSIX_Message_queue_Control *the_mq;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
if ( mqstat == NULL ) {
rtems_set_errno_and_return_minus_one( EINVAL );
}
- the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
+ the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
if ( the_mq == NULL ) {
rtems_set_errno_and_return_minus_one( EBADF );
@@ -56,11 +56,11 @@ int mq_getattr(
_CORE_message_queue_Acquire_critical(
&the_mq->Message_queue,
- &lock_context
+ &queue_context
);
if ( the_mq->open_count == 0 ) {
- _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
rtems_set_errno_and_return_minus_one( EBADF );
}
@@ -72,6 +72,6 @@ int mq_getattr(
mqstat->mq_maxmsg = the_mq->Message_queue.maximum_pending_messages;
mqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
- _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
return 0;
}
diff --git a/cpukit/posix/src/mqueuenotify.c b/cpukit/posix/src/mqueuenotify.c
index adcfdcb8f2..a1f9a089f8 100644
--- a/cpukit/posix/src/mqueuenotify.c
+++ b/cpukit/posix/src/mqueuenotify.c
@@ -24,7 +24,7 @@
static void _POSIX_Message_queue_Notify_handler(
CORE_message_queue_Control *the_message_queue,
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
POSIX_Message_queue_Control *the_mq;
@@ -38,7 +38,7 @@ static void _POSIX_Message_queue_Notify_handler(
signo = the_mq->notification.sigev_signo;
_CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL );
- _CORE_message_queue_Release( &the_mq->Message_queue, lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, queue_context );
kill( getpid(), signo );
}
@@ -49,9 +49,9 @@ int mq_notify(
)
{
POSIX_Message_queue_Control *the_mq;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
- the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
+ the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
if ( the_mq == NULL ) {
rtems_set_errno_and_return_minus_one( EBADF );
@@ -59,17 +59,17 @@ int mq_notify(
_CORE_message_queue_Acquire_critical(
&the_mq->Message_queue,
- &lock_context
+ &queue_context
);
if ( the_mq->open_count == 0 ) {
- _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
rtems_set_errno_and_return_minus_one( EBADF );
}
if ( notification != NULL ) {
if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
- _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
rtems_set_errno_and_return_minus_one( EBUSY );
}
@@ -83,6 +83,6 @@ int mq_notify(
_CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL );
}
- _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
return 0;
}
diff --git a/cpukit/posix/src/mqueuerecvsupp.c b/cpukit/posix/src/mqueuerecvsupp.c
index b5a790a2bd..541786a850 100644
--- a/cpukit/posix/src/mqueuerecvsupp.c
+++ b/cpukit/posix/src/mqueuerecvsupp.c
@@ -44,24 +44,24 @@ ssize_t _POSIX_Message_queue_Receive_support(
)
{
POSIX_Message_queue_Control *the_mq;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
size_t length_out;
bool do_wait;
Thread_Control *executing;
- the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
+ the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
if ( the_mq == NULL ) {
rtems_set_errno_and_return_minus_one( EBADF );
}
if ( ( the_mq->oflag & O_ACCMODE ) == O_WRONLY ) {
- _ISR_lock_ISR_enable( &lock_context );
+ _ISR_lock_ISR_enable( &queue_context.Lock_context );
rtems_set_errno_and_return_minus_one( EBADF );
}
if ( msg_len < the_mq->Message_queue.maximum_message_size ) {
- _ISR_lock_ISR_enable( &lock_context );
+ _ISR_lock_ISR_enable( &queue_context.Lock_context );
rtems_set_errno_and_return_minus_one( EMSGSIZE );
}
@@ -83,11 +83,11 @@ ssize_t _POSIX_Message_queue_Receive_support(
_CORE_message_queue_Acquire_critical(
&the_mq->Message_queue,
- &lock_context
+ &queue_context
);
if ( the_mq->open_count == 0 ) {
- _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
rtems_set_errno_and_return_minus_one( EBADF );
}
@@ -102,7 +102,7 @@ ssize_t _POSIX_Message_queue_Receive_support(
&length_out,
do_wait,
timeout,
- &lock_context
+ &queue_context
);
if ( msg_prio != NULL ) {
diff --git a/cpukit/posix/src/mqueuesendsupp.c b/cpukit/posix/src/mqueuesendsupp.c
index 8933fc691e..2d88eec7a8 100644
--- a/cpukit/posix/src/mqueuesendsupp.c
+++ b/cpukit/posix/src/mqueuesendsupp.c
@@ -44,7 +44,7 @@ int _POSIX_Message_queue_Send_support(
)
{
POSIX_Message_queue_Control *the_mq;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
CORE_message_queue_Status msg_status;
bool do_wait;
Thread_Control *executing;
@@ -58,14 +58,14 @@ int _POSIX_Message_queue_Send_support(
rtems_set_errno_and_return_minus_one( EINVAL );
}
- the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
+ the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
if ( the_mq == NULL ) {
rtems_set_errno_and_return_minus_one( EBADF );
}
if ( ( the_mq->oflag & O_ACCMODE ) == O_RDONLY ) {
- _ISR_lock_ISR_enable( &lock_context );
+ _ISR_lock_ISR_enable( &queue_context.Lock_context );
rtems_set_errno_and_return_minus_one( EBADF );
}
@@ -80,11 +80,11 @@ int _POSIX_Message_queue_Send_support(
_CORE_message_queue_Acquire_critical(
&the_mq->Message_queue,
- &lock_context
+ &queue_context
);
if ( the_mq->open_count == 0 ) {
- _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
rtems_set_errno_and_return_minus_one( EBADF );
}
@@ -97,11 +97,10 @@ int _POSIX_Message_queue_Send_support(
executing,
msg_ptr,
msg_len,
- NULL,
_POSIX_Message_queue_Priority_to_core( msg_prio ),
do_wait,
timeout,
- &lock_context
+ &queue_context
);
if ( msg_status != CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL ) {
diff --git a/cpukit/posix/src/mqueuesetattr.c b/cpukit/posix/src/mqueuesetattr.c
index dfd9bab216..fc9fc75ecf 100644
--- a/cpukit/posix/src/mqueuesetattr.c
+++ b/cpukit/posix/src/mqueuesetattr.c
@@ -27,13 +27,13 @@ int mq_setattr(
)
{
POSIX_Message_queue_Control *the_mq;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
if ( mqstat == NULL ) {
rtems_set_errno_and_return_minus_one( EINVAL );
}
- the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
+ the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
if ( the_mq == NULL ) {
rtems_set_errno_and_return_minus_one( EBADF );
@@ -41,11 +41,11 @@ int mq_setattr(
_CORE_message_queue_Acquire_critical(
&the_mq->Message_queue,
- &lock_context
+ &queue_context
);
if ( the_mq->open_count == 0 ) {
- _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
rtems_set_errno_and_return_minus_one( EBADF );
}
@@ -62,6 +62,6 @@ int mq_setattr(
the_mq->oflag = mqstat->mq_flags;
- _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
return 0;
}
diff --git a/cpukit/posix/src/mqueueunlink.c b/cpukit/posix/src/mqueueunlink.c
index dc485ba657..812f249df5 100644
--- a/cpukit/posix/src/mqueueunlink.c
+++ b/cpukit/posix/src/mqueueunlink.c
@@ -30,7 +30,7 @@ int mq_unlink(
{
POSIX_Message_queue_Control *the_mq;
Objects_Get_by_name_error error;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
_Objects_Allocator_lock();
@@ -42,10 +42,10 @@ int mq_unlink(
_POSIX_Message_queue_Namespace_remove( the_mq );
- _CORE_message_queue_Acquire( &the_mq->Message_queue, &lock_context );
+ _CORE_message_queue_Acquire( &the_mq->Message_queue, &queue_context );
the_mq->linked = false;
- _POSIX_Message_queue_Delete( the_mq, &lock_context );
+ _POSIX_Message_queue_Delete( the_mq, &queue_context );
_Objects_Allocator_unlock();
return 0;
diff --git a/cpukit/posix/src/mutexdestroy.c b/cpukit/posix/src/mutexdestroy.c
index 640acc0e5a..7fda7d3ac9 100644
--- a/cpukit/posix/src/mutexdestroy.c
+++ b/cpukit/posix/src/mutexdestroy.c
@@ -28,16 +28,16 @@ int pthread_mutex_destroy(
pthread_mutex_t *mutex
)
{
- POSIX_Mutex_Control *the_mutex;
- ISR_lock_Context lock_context;
- int eno;
+ POSIX_Mutex_Control *the_mutex;
+ Thread_queue_Context queue_context;
+ int eno;
_Objects_Allocator_lock();
- the_mutex = _POSIX_Mutex_Get( mutex, &lock_context );
+ the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
if ( the_mutex != NULL ) {
- _CORE_mutex_Acquire_critical( &the_mutex->Mutex, &lock_context );
+ _CORE_mutex_Acquire_critical( &the_mutex->Mutex, &queue_context );
/*
* XXX: There is an error for the mutex being locked
@@ -46,12 +46,12 @@ int pthread_mutex_destroy(
if ( !_CORE_mutex_Is_locked( &the_mutex->Mutex ) ) {
_Objects_Close( &_POSIX_Mutex_Information, &the_mutex->Object );
- _CORE_mutex_Release( &the_mutex->Mutex, &lock_context );
+ _CORE_mutex_Release( &the_mutex->Mutex, &queue_context );
_CORE_mutex_Destroy( &the_mutex->Mutex );
_POSIX_Mutex_Free( the_mutex );
eno = 0;
} else {
- _CORE_mutex_Release( &the_mutex->Mutex, &lock_context );
+ _CORE_mutex_Release( &the_mutex->Mutex, &queue_context );
eno = EBUSY;
}
} else {
diff --git a/cpukit/posix/src/mutexget.c b/cpukit/posix/src/mutexget.c
index f8f003353a..e90c41c3a2 100644
--- a/cpukit/posix/src/mutexget.c
+++ b/cpukit/posix/src/mutexget.c
@@ -22,14 +22,14 @@
#include <rtems/posix/posixapi.h>
POSIX_Mutex_Control *_POSIX_Mutex_Get(
- pthread_mutex_t *mutex,
- ISR_lock_Context *lock_context
+ pthread_mutex_t *mutex,
+ Thread_queue_Context *queue_context
)
{
_POSIX_Get_object_body(
POSIX_Mutex_Control,
mutex,
- lock_context,
+ queue_context,
&_POSIX_Mutex_Information,
PTHREAD_MUTEX_INITIALIZER,
pthread_mutex_init
diff --git a/cpukit/posix/src/mutexgetprioceiling.c b/cpukit/posix/src/mutexgetprioceiling.c
index 232b2e2a80..268457a73e 100644
--- a/cpukit/posix/src/mutexgetprioceiling.c
+++ b/cpukit/posix/src/mutexgetprioceiling.c
@@ -30,26 +30,26 @@ int pthread_mutex_getprioceiling(
int *prioceiling
)
{
- POSIX_Mutex_Control *the_mutex;
- ISR_lock_Context lock_context;
+ POSIX_Mutex_Control *the_mutex;
+ Thread_queue_Context queue_context;
if ( prioceiling == NULL ) {
return EINVAL;
}
- the_mutex = _POSIX_Mutex_Get( mutex, &lock_context );
+ the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
if ( the_mutex == NULL ) {
return EINVAL;
}
- _CORE_mutex_Acquire_critical( &the_mutex->Mutex, &lock_context );
+ _CORE_mutex_Acquire_critical( &the_mutex->Mutex, &queue_context );
*prioceiling = _POSIX_Priority_From_core(
the_mutex->Mutex.Attributes.priority_ceiling
);
- _CORE_mutex_Release( &the_mutex->Mutex, &lock_context );
+ _CORE_mutex_Release( &the_mutex->Mutex, &queue_context );
return 0;
}
diff --git a/cpukit/posix/src/mutexlocksupp.c b/cpukit/posix/src/mutexlocksupp.c
index 0c70cf06e2..f17269bf21 100644
--- a/cpukit/posix/src/mutexlocksupp.c
+++ b/cpukit/posix/src/mutexlocksupp.c
@@ -28,11 +28,11 @@ int _POSIX_Mutex_Lock_support(
Watchdog_Interval timeout
)
{
- POSIX_Mutex_Control *the_mutex;
- ISR_lock_Context lock_context;
- Thread_Control *executing;
+ POSIX_Mutex_Control *the_mutex;
+ Thread_queue_Context queue_context;
+ Thread_Control *executing;
- the_mutex = _POSIX_Mutex_Get( mutex, &lock_context );
+ the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
if ( the_mutex == NULL ) {
return EINVAL;
@@ -44,7 +44,7 @@ int _POSIX_Mutex_Lock_support(
executing,
blocking,
timeout,
- &lock_context
+ &queue_context
);
return _POSIX_Mutex_Translate_core_mutex_return_code(
(CORE_mutex_Status) executing->Wait.return_code
diff --git a/cpukit/posix/src/mutexsetprioceiling.c b/cpukit/posix/src/mutexsetprioceiling.c
index f29c0ad116..09554f84c4 100644
--- a/cpukit/posix/src/mutexsetprioceiling.c
+++ b/cpukit/posix/src/mutexsetprioceiling.c
@@ -33,7 +33,7 @@ int pthread_mutex_setprioceiling(
{
register POSIX_Mutex_Control *the_mutex;
Priority_Control the_priority;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
if ( !old_ceiling )
return EINVAL;
@@ -57,7 +57,7 @@ int pthread_mutex_setprioceiling(
* NOTE: This makes it easier to get 100% binary coverage since the
* bad Id case is handled by the switch.
*/
- the_mutex = _POSIX_Mutex_Get( mutex, &lock_context );
+ the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
if ( the_mutex == NULL ) {
return EINVAL;
@@ -73,8 +73,7 @@ int pthread_mutex_setprioceiling(
*/
_CORE_mutex_Surrender(
&the_mutex->Mutex,
- NULL,
- &lock_context
+ &queue_context
);
return 0;
}
diff --git a/cpukit/posix/src/mutexunlock.c b/cpukit/posix/src/mutexunlock.c
index 94fcc63364..ff7fc1c789 100644
--- a/cpukit/posix/src/mutexunlock.c
+++ b/cpukit/posix/src/mutexunlock.c
@@ -30,20 +30,16 @@ int pthread_mutex_unlock(
pthread_mutex_t *mutex
)
{
- POSIX_Mutex_Control *the_mutex;
- CORE_mutex_Status status;
- ISR_lock_Context lock_context;
+ POSIX_Mutex_Control *the_mutex;
+ CORE_mutex_Status status;
+ Thread_queue_Context queue_context;
- the_mutex = _POSIX_Mutex_Get( mutex, &lock_context );
+ the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
if ( the_mutex == NULL ) {
return EINVAL;
}
- status = _CORE_mutex_Surrender(
- &the_mutex->Mutex,
- NULL,
- &lock_context
- );
+ status = _CORE_mutex_Surrender( &the_mutex->Mutex, &queue_context );
return _POSIX_Mutex_Translate_core_mutex_return_code( status );
}
diff --git a/cpukit/posix/src/pbarrierdestroy.c b/cpukit/posix/src/pbarrierdestroy.c
index 709644bf4e..8f85762211 100644
--- a/cpukit/posix/src/pbarrierdestroy.c
+++ b/cpukit/posix/src/pbarrierdestroy.c
@@ -36,30 +36,30 @@ int pthread_barrier_destroy(
)
{
POSIX_Barrier_Control *the_barrier;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
if ( barrier == NULL ) {
return EINVAL;
}
_Objects_Allocator_lock();
- the_barrier = _POSIX_Barrier_Get( barrier, &lock_context );
+ the_barrier = _POSIX_Barrier_Get( barrier, &queue_context );
if ( the_barrier == NULL ) {
_Objects_Allocator_unlock();
return EINVAL;
}
- _CORE_barrier_Acquire_critical( &the_barrier->Barrier, &lock_context );
+ _CORE_barrier_Acquire_critical( &the_barrier->Barrier, &queue_context );
if ( the_barrier->Barrier.number_of_waiting_threads != 0 ) {
- _CORE_barrier_Release( &the_barrier->Barrier, &lock_context );
+ _CORE_barrier_Release( &the_barrier->Barrier, &queue_context );
_Objects_Allocator_unlock();
return EBUSY;
}
_Objects_Close( &_POSIX_Barrier_Information, &the_barrier->Object );
- _CORE_barrier_Release( &the_barrier->Barrier, &lock_context );
+ _CORE_barrier_Release( &the_barrier->Barrier, &queue_context );
_POSIX_Barrier_Free( the_barrier );
_Objects_Allocator_unlock();
return 0;
diff --git a/cpukit/posix/src/pbarrierwait.c b/cpukit/posix/src/pbarrierwait.c
index adfd40df1b..522c18ec84 100644
--- a/cpukit/posix/src/pbarrierwait.c
+++ b/cpukit/posix/src/pbarrierwait.c
@@ -37,14 +37,14 @@ int pthread_barrier_wait(
)
{
POSIX_Barrier_Control *the_barrier;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Thread_Control *executing;
if ( barrier == NULL ) {
return EINVAL;
}
- the_barrier = _POSIX_Barrier_Get( barrier, &lock_context );
+ the_barrier = _POSIX_Barrier_Get( barrier, &queue_context );
if ( the_barrier == NULL ) {
return EINVAL;
@@ -56,8 +56,7 @@ int pthread_barrier_wait(
executing,
true,
0,
- NULL,
- &lock_context
+ &queue_context
);
return _POSIX_Barrier_Translate_core_barrier_return_code(
executing->Wait.return_code
diff --git a/cpukit/posix/src/prwlockdestroy.c b/cpukit/posix/src/prwlockdestroy.c
index 6f9eec8a1d..0ced556146 100644
--- a/cpukit/posix/src/prwlockdestroy.c
+++ b/cpukit/posix/src/prwlockdestroy.c
@@ -24,24 +24,24 @@ int pthread_rwlock_destroy(
)
{
POSIX_RWLock_Control *the_rwlock;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
_Objects_Allocator_lock();
- the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
+ the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
if ( the_rwlock == NULL ) {
_Objects_Allocator_unlock();
return EINVAL;
}
- _CORE_RWLock_Acquire_critical( &the_rwlock->RWLock, &lock_context );
+ _CORE_RWLock_Acquire_critical( &the_rwlock->RWLock, &queue_context );
/*
* If there is at least one thread waiting, then do not delete it.
*/
if ( !_Thread_queue_Is_empty( &the_rwlock->RWLock.Wait_queue.Queue ) ) {
- _CORE_RWLock_Release( &the_rwlock->RWLock, &lock_context );
+ _CORE_RWLock_Release( &the_rwlock->RWLock, &queue_context );
_Objects_Allocator_unlock();
return EBUSY;
}
@@ -51,7 +51,7 @@ int pthread_rwlock_destroy(
*/
_Objects_Close( &_POSIX_RWLock_Information, &the_rwlock->Object );
- _CORE_RWLock_Release( &the_rwlock->RWLock, &lock_context );
+ _CORE_RWLock_Release( &the_rwlock->RWLock, &queue_context );
_POSIX_RWLock_Free( the_rwlock );
_Objects_Allocator_unlock();
return 0;
diff --git a/cpukit/posix/src/prwlockinit.c b/cpukit/posix/src/prwlockinit.c
index fcf4e29a34..34ab1aeff1 100644
--- a/cpukit/posix/src/prwlockinit.c
+++ b/cpukit/posix/src/prwlockinit.c
@@ -24,14 +24,14 @@
#include <rtems/posix/posixapi.h>
POSIX_RWLock_Control *_POSIX_RWLock_Get(
- pthread_rwlock_t *rwlock,
- ISR_lock_Context *lock_context
+ pthread_rwlock_t *rwlock,
+ Thread_queue_Context *queue_context
)
{
_POSIX_Get_object_body(
POSIX_RWLock_Control,
rwlock,
- lock_context,
+ queue_context,
&_POSIX_RWLock_Information,
PTHREAD_RWLOCK_INITIALIZER,
pthread_rwlock_init
diff --git a/cpukit/posix/src/prwlockrdlock.c b/cpukit/posix/src/prwlockrdlock.c
index 3459399c6b..e59aaf9adb 100644
--- a/cpukit/posix/src/prwlockrdlock.c
+++ b/cpukit/posix/src/prwlockrdlock.c
@@ -25,10 +25,10 @@ int pthread_rwlock_rdlock(
)
{
POSIX_RWLock_Control *the_rwlock;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Thread_Control *executing;
- the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
+ the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
if ( the_rwlock == NULL ) {
return EINVAL;
@@ -40,7 +40,7 @@ int pthread_rwlock_rdlock(
executing,
true, /* we are willing to wait forever */
0,
- &lock_context
+ &queue_context
);
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) executing->Wait.return_code
diff --git a/cpukit/posix/src/prwlocktimedrdlock.c b/cpukit/posix/src/prwlocktimedrdlock.c
index 829e1696a3..9e849438dd 100644
--- a/cpukit/posix/src/prwlocktimedrdlock.c
+++ b/cpukit/posix/src/prwlocktimedrdlock.c
@@ -27,7 +27,7 @@ int pthread_rwlock_timedrdlock(
)
{
POSIX_RWLock_Control *the_rwlock;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Watchdog_Interval ticks;
bool do_wait;
TOD_Absolute_timeout_conversion_results status;
@@ -49,7 +49,7 @@ int pthread_rwlock_timedrdlock(
status = _TOD_Absolute_timeout_to_ticks( abstime, &ticks );
do_wait = ( status == TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE );
- the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
+ the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
if ( the_rwlock == NULL ) {
return EINVAL;
@@ -61,7 +61,7 @@ int pthread_rwlock_timedrdlock(
executing,
do_wait,
ticks,
- &lock_context
+ &queue_context
);
if (
diff --git a/cpukit/posix/src/prwlocktimedwrlock.c b/cpukit/posix/src/prwlocktimedwrlock.c
index 1258c2bebb..6be8397ef7 100644
--- a/cpukit/posix/src/prwlocktimedwrlock.c
+++ b/cpukit/posix/src/prwlocktimedwrlock.c
@@ -29,7 +29,7 @@ int pthread_rwlock_timedwrlock(
)
{
POSIX_RWLock_Control *the_rwlock;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Watchdog_Interval ticks;
bool do_wait;
TOD_Absolute_timeout_conversion_results status;
@@ -51,7 +51,7 @@ int pthread_rwlock_timedwrlock(
status = _TOD_Absolute_timeout_to_ticks( abstime, &ticks );
do_wait = ( status == TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE );
- the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
+ the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
if ( the_rwlock == NULL ) {
return EINVAL;
@@ -63,7 +63,7 @@ int pthread_rwlock_timedwrlock(
executing,
do_wait,
ticks,
- &lock_context
+ &queue_context
);
if (
diff --git a/cpukit/posix/src/prwlocktryrdlock.c b/cpukit/posix/src/prwlocktryrdlock.c
index a73d122ed6..1a7cf9efe1 100644
--- a/cpukit/posix/src/prwlocktryrdlock.c
+++ b/cpukit/posix/src/prwlocktryrdlock.c
@@ -25,10 +25,10 @@ int pthread_rwlock_tryrdlock(
)
{
POSIX_RWLock_Control *the_rwlock;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Thread_Control *executing;
- the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
+ the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
if ( the_rwlock == NULL ) {
return EINVAL;
@@ -40,7 +40,7 @@ int pthread_rwlock_tryrdlock(
executing,
false, /* do not wait for the rwlock */
0,
- &lock_context
+ &queue_context
);
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) executing->Wait.return_code
diff --git a/cpukit/posix/src/prwlocktrywrlock.c b/cpukit/posix/src/prwlocktrywrlock.c
index a44a54ffb5..b6031f9b42 100644
--- a/cpukit/posix/src/prwlocktrywrlock.c
+++ b/cpukit/posix/src/prwlocktrywrlock.c
@@ -25,10 +25,10 @@ int pthread_rwlock_trywrlock(
)
{
POSIX_RWLock_Control *the_rwlock;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Thread_Control *executing;
- the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
+ the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
if ( the_rwlock == NULL ) {
return EINVAL;
@@ -40,7 +40,7 @@ int pthread_rwlock_trywrlock(
executing,
false, /* we are not willing to wait */
0,
- &lock_context
+ &queue_context
);
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) executing->Wait.return_code
diff --git a/cpukit/posix/src/prwlockunlock.c b/cpukit/posix/src/prwlockunlock.c
index bf6b4deaf0..dd4337d7d0 100644
--- a/cpukit/posix/src/prwlockunlock.c
+++ b/cpukit/posix/src/prwlockunlock.c
@@ -27,15 +27,15 @@ int pthread_rwlock_unlock(
)
{
POSIX_RWLock_Control *the_rwlock;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
CORE_RWLock_Status status;
- the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
+ the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
if ( the_rwlock == NULL ) {
return EINVAL;
}
- status = _CORE_RWLock_Surrender( &the_rwlock->RWLock, &lock_context );
+ status = _CORE_RWLock_Surrender( &the_rwlock->RWLock, &queue_context );
return _POSIX_RWLock_Translate_core_RWLock_return_code( status );
}
diff --git a/cpukit/posix/src/prwlockwrlock.c b/cpukit/posix/src/prwlockwrlock.c
index 568316363a..84a4e0f04b 100644
--- a/cpukit/posix/src/prwlockwrlock.c
+++ b/cpukit/posix/src/prwlockwrlock.c
@@ -32,10 +32,10 @@ int pthread_rwlock_wrlock(
)
{
POSIX_RWLock_Control *the_rwlock;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Thread_Control *executing;
- the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
+ the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
if ( the_rwlock == NULL ) {
return EINVAL;
@@ -47,7 +47,7 @@ int pthread_rwlock_wrlock(
executing,
true, /* do not timeout -- wait forever */
0,
- &lock_context
+ &queue_context
);
return _POSIX_RWLock_Translate_core_RWLock_return_code(
(CORE_RWLock_Status) executing->Wait.return_code
diff --git a/cpukit/posix/src/semaphoredeletesupp.c b/cpukit/posix/src/semaphoredeletesupp.c
index c205b1223f..2d39b2aad5 100644
--- a/cpukit/posix/src/semaphoredeletesupp.c
+++ b/cpukit/posix/src/semaphoredeletesupp.c
@@ -22,18 +22,14 @@
void _POSIX_Semaphore_Delete(
POSIX_Semaphore_Control *the_semaphore,
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
if ( !the_semaphore->linked && !the_semaphore->open_count ) {
_Objects_Close( &_POSIX_Semaphore_Information, &the_semaphore->Object );
- _CORE_semaphore_Destroy(
- &the_semaphore->Semaphore,
- NULL,
- lock_context
- );
+ _CORE_semaphore_Destroy( &the_semaphore->Semaphore, queue_context );
_POSIX_Semaphore_Free( the_semaphore );
} else {
- _CORE_semaphore_Release( &the_semaphore->Semaphore, lock_context );
+ _CORE_semaphore_Release( &the_semaphore->Semaphore, queue_context );
}
}
diff --git a/cpukit/posix/src/semaphorewaitsupp.c b/cpukit/posix/src/semaphorewaitsupp.c
index f08efa8e22..9382107d90 100644
--- a/cpukit/posix/src/semaphorewaitsupp.c
+++ b/cpukit/posix/src/semaphorewaitsupp.c
@@ -32,9 +32,9 @@ int _POSIX_Semaphore_Wait_support(
{
POSIX_Semaphore_Control *the_semaphore;
Thread_Control *executing;
- 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 );
@@ -47,7 +47,7 @@ int _POSIX_Semaphore_Wait_support(
executing,
blocking,
timeout,
- &lock_context
+ &queue_context
);
if ( executing->Wait.return_code == CORE_SEMAPHORE_STATUS_SUCCESSFUL ) {
diff --git a/cpukit/posix/src/semclose.c b/cpukit/posix/src/semclose.c
index 3f18ff1efe..ebcf7a26b3 100644
--- a/cpukit/posix/src/semclose.c
+++ b/cpukit/posix/src/semclose.c
@@ -27,10 +27,10 @@ int sem_close(
)
{
POSIX_Semaphore_Control *the_semaphore;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
_Objects_Allocator_lock();
- the_semaphore = _POSIX_Semaphore_Get( sem, &lock_context );
+ the_semaphore = _POSIX_Semaphore_Get( sem, &queue_context );
if ( the_semaphore == NULL ) {
_Objects_Allocator_unlock();
@@ -39,10 +39,10 @@ int sem_close(
_CORE_semaphore_Acquire_critical(
&the_semaphore->Semaphore,
- &lock_context
+ &queue_context
);
the_semaphore->open_count -= 1;
- _POSIX_Semaphore_Delete( the_semaphore, &lock_context );
+ _POSIX_Semaphore_Delete( the_semaphore, &queue_context );
_Objects_Allocator_unlock();
return 0;
diff --git a/cpukit/posix/src/semdestroy.c b/cpukit/posix/src/semdestroy.c
index 5264472156..8b81470bbf 100644
--- a/cpukit/posix/src/semdestroy.c
+++ b/cpukit/posix/src/semdestroy.c
@@ -27,10 +27,10 @@ int sem_destroy(
)
{
POSIX_Semaphore_Control *the_semaphore;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
_Objects_Allocator_lock();
- the_semaphore = _POSIX_Semaphore_Get( sem, &lock_context );
+ the_semaphore = _POSIX_Semaphore_Get( sem, &queue_context );
if ( the_semaphore == NULL ) {
_Objects_Allocator_unlock();
@@ -39,17 +39,17 @@ int sem_destroy(
_CORE_semaphore_Acquire_critical(
&the_semaphore->Semaphore,
- &lock_context
+ &queue_context
);
if ( the_semaphore->named ) {
/* Undefined operation on a named semaphore */
- _CORE_semaphore_Release( &the_semaphore->Semaphore, &lock_context );
+ _CORE_semaphore_Release( &the_semaphore->Semaphore, &queue_context );
_Objects_Allocator_unlock();
rtems_set_errno_and_return_minus_one( EINVAL );
}
- _POSIX_Semaphore_Delete( the_semaphore, &lock_context );
+ _POSIX_Semaphore_Delete( the_semaphore, &queue_context );
_Objects_Allocator_unlock();
return 0;
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;
}
diff --git a/cpukit/posix/src/sempost.c b/cpukit/posix/src/sempost.c
index 313ff3cdf3..86d2f5acf6 100644
--- a/cpukit/posix/src/sempost.c
+++ b/cpukit/posix/src/sempost.c
@@ -27,9 +27,9 @@ int sem_post(
)
{
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 );
@@ -37,8 +37,7 @@ int sem_post(
_CORE_semaphore_Surrender(
&the_semaphore->Semaphore,
- NULL,
- &lock_context
+ &queue_context
);
return 0;
}
diff --git a/cpukit/posix/src/semunlink.c b/cpukit/posix/src/semunlink.c
index 665aa7337c..6ba1df17a4 100644
--- a/cpukit/posix/src/semunlink.c
+++ b/cpukit/posix/src/semunlink.c
@@ -28,7 +28,7 @@ int sem_unlink(
{
POSIX_Semaphore_Control *the_semaphore;
Objects_Get_by_name_error error;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
_Objects_Allocator_lock();
@@ -40,10 +40,10 @@ int sem_unlink(
_POSIX_Semaphore_Namespace_remove( the_semaphore );
- _ISR_lock_ISR_disable( &lock_context );
- _CORE_semaphore_Acquire_critical( &the_semaphore->Semaphore, &lock_context );
+ _ISR_lock_ISR_disable( &queue_context.Lock_context );
+ _CORE_semaphore_Acquire_critical( &the_semaphore->Semaphore, &queue_context );
the_semaphore->linked = false;
- _POSIX_Semaphore_Delete( the_semaphore, &lock_context );
+ _POSIX_Semaphore_Delete( the_semaphore, &queue_context );
_Objects_Allocator_unlock();
return 0;