summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-23 10:01:31 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-29 07:26:42 +0200
commit1e1a91ed11458ddbb27b94d0001d8f0fc2ef7a97 (patch)
tree5e7cb0e88da11528eb7fb4bae9148564c949d066 /cpukit/posix/src
parentlibcpu/m68k/mcf5272/clock/ckinit.c: Fix warning by including <rtems/clockdrv.h> (diff)
downloadrtems-1e1a91ed11458ddbb27b94d0001d8f0fc2ef7a97.tar.bz2
score: Remove Thread_queue_Queue::operations field
Remove the Thread_queue_Queue::operations field to reduce the size of this structure. Add a thread queue operations parameter to the _Thread_queue_First(), _Thread_queue_First_locked(), _Thread_queue_Enqueue(), _Thread_queue_Dequeue() and _Thread_queue_Flush() functions. This is a preparation patch to reduce the size of several synchronization objects.
Diffstat (limited to '')
-rw-r--r--cpukit/posix/src/conddestroy.c7
-rw-r--r--cpukit/posix/src/condinit.c5
-rw-r--r--cpukit/posix/src/condsignalsupp.c5
-rw-r--r--cpukit/posix/src/condwaitsupp.c1
-rw-r--r--cpukit/posix/src/mqueuecreatesupp.c6
-rw-r--r--cpukit/posix/src/nanosleep.c3
-rw-r--r--cpukit/posix/src/prwlockdestroy.c7
-rw-r--r--cpukit/posix/src/psignal.c11
-rw-r--r--cpukit/posix/src/pthread.c7
-rw-r--r--cpukit/posix/src/pthreadexit.c4
-rw-r--r--cpukit/posix/src/pthreadjoin.c1
-rw-r--r--cpukit/posix/src/semaphorecreatesupp.c21
-rw-r--r--cpukit/posix/src/sigtimedwait.c2
13 files changed, 39 insertions, 41 deletions
diff --git a/cpukit/posix/src/conddestroy.c b/cpukit/posix/src/conddestroy.c
index 79c50232eb..c6696f506c 100644
--- a/cpukit/posix/src/conddestroy.c
+++ b/cpukit/posix/src/conddestroy.c
@@ -43,7 +43,12 @@ int pthread_cond_destroy(
case OBJECTS_LOCAL:
- if ( _Thread_queue_First( &the_cond->Wait_queue ) ) {
+ if (
+ _Thread_queue_First(
+ &the_cond->Wait_queue,
+ POSIX_CONDITION_VARIABLES_TQ_OPERATIONS
+ )
+ ) {
_Objects_Put( &the_cond->Object );
_Objects_Allocator_unlock();
return EBUSY;
diff --git a/cpukit/posix/src/condinit.c b/cpukit/posix/src/condinit.c
index eb31da0e80..f4aeae657d 100644
--- a/cpukit/posix/src/condinit.c
+++ b/cpukit/posix/src/condinit.c
@@ -61,10 +61,7 @@ int pthread_cond_init(
the_cond->Mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
- _Thread_queue_Initialize(
- &the_cond->Wait_queue,
- THREAD_QUEUE_DISCIPLINE_FIFO
- );
+ _Thread_queue_Initialize( &the_cond->Wait_queue );
_Objects_Open_u32(
&_POSIX_Condition_variables_Information,
diff --git a/cpukit/posix/src/condsignalsupp.c b/cpukit/posix/src/condsignalsupp.c
index 938b5e50d2..b2a0b1afe8 100644
--- a/cpukit/posix/src/condsignalsupp.c
+++ b/cpukit/posix/src/condsignalsupp.c
@@ -47,7 +47,10 @@ int _POSIX_Condition_variables_Signal_support(
case OBJECTS_LOCAL:
do {
- the_thread = _Thread_queue_Dequeue( &the_cond->Wait_queue );
+ the_thread = _Thread_queue_Dequeue(
+ &the_cond->Wait_queue,
+ POSIX_CONDITION_VARIABLES_TQ_OPERATIONS
+ );
if ( !the_thread )
the_cond->Mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
} while ( is_broadcast && the_thread );
diff --git a/cpukit/posix/src/condwaitsupp.c b/cpukit/posix/src/condwaitsupp.c
index 5b7fb5d7a4..d4e2403058 100644
--- a/cpukit/posix/src/condwaitsupp.c
+++ b/cpukit/posix/src/condwaitsupp.c
@@ -79,6 +79,7 @@ int _POSIX_Condition_variables_Wait_support(
_Thread_queue_Enqueue(
&the_cond->Wait_queue,
+ POSIX_CONDITION_VARIABLES_TQ_OPERATIONS,
executing,
STATES_WAITING_FOR_CONDITION_VARIABLE
| STATES_INTERRUPTIBLE_BY_SIGNAL,
diff --git a/cpukit/posix/src/mqueuecreatesupp.c b/cpukit/posix/src/mqueuecreatesupp.c
index 6d407314f2..06192ec222 100644
--- a/cpukit/posix/src/mqueuecreatesupp.c
+++ b/cpukit/posix/src/mqueuecreatesupp.c
@@ -55,7 +55,6 @@ int _POSIX_Message_queue_Create_support(
)
{
POSIX_Message_queue_Control *the_mq;
- CORE_message_queue_Attributes *the_mq_attr;
struct mq_attr attr;
char *name;
@@ -111,12 +110,9 @@ int _POSIX_Message_queue_Create_support(
* Joel: Cite POSIX or OpenGroup on above statement so we can determine
* if it is a real requirement.
*/
- the_mq_attr = &the_mq->Message_queue.Attributes;
- the_mq_attr->discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
-
if ( !_CORE_message_queue_Initialize(
&the_mq->Message_queue,
- the_mq_attr,
+ CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
attr.mq_maxmsg,
attr.mq_msgsize
) ) {
diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c
index 21bdb986b6..b24b74d00b 100644
--- a/cpukit/posix/src/nanosleep.c
+++ b/cpukit/posix/src/nanosleep.c
@@ -28,7 +28,7 @@
#include <rtems/score/watchdogimpl.h>
static Thread_queue_Control _Nanosleep_Pseudo_queue =
- THREAD_QUEUE_FIFO_INITIALIZER( _Nanosleep_Pseudo_queue, "Nanosleep" );
+ THREAD_QUEUE_INITIALIZER( "Nanosleep" );
/*
* 14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
@@ -89,6 +89,7 @@ int nanosleep(
*/
_Thread_queue_Enqueue(
&_Nanosleep_Pseudo_queue,
+ &_Thread_queue_Operations_FIFO,
executing,
STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL,
ticks,
diff --git a/cpukit/posix/src/prwlockdestroy.c b/cpukit/posix/src/prwlockdestroy.c
index f3e08add06..a675b90757 100644
--- a/cpukit/posix/src/prwlockdestroy.c
+++ b/cpukit/posix/src/prwlockdestroy.c
@@ -49,7 +49,12 @@ int pthread_rwlock_destroy(
/*
* If there is at least one thread waiting, then do not delete it.
*/
- if ( _Thread_queue_First( &the_rwlock->RWLock.Wait_queue ) != NULL ) {
+ if (
+ _Thread_queue_First(
+ &the_rwlock->RWLock.Wait_queue,
+ CORE_RWLOCK_TQ_OPERATIONS
+ ) != NULL
+ ) {
_Objects_Put( &the_rwlock->Object );
_Objects_Allocator_unlock();
return EBUSY;
diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c
index 08b049bc46..18aad9667e 100644
--- a/cpukit/posix/src/psignal.c
+++ b/cpukit/posix/src/psignal.c
@@ -92,7 +92,8 @@ const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ] = {
struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ];
-Thread_queue_Control _POSIX_signals_Wait_queue;
+Thread_queue_Control _POSIX_signals_Wait_queue =
+ THREAD_QUEUE_INITIALIZER( "POSIX Signals" );
Chain_Control _POSIX_signals_Inactive_siginfo;
Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ];
@@ -185,14 +186,6 @@ static void _POSIX_signals_Manager_Initialization(void)
*/
sigemptyset( &_POSIX_signals_Pending );
- /*
- * Initialize the queue we use to block for signals
- */
- _Thread_queue_Initialize(
- &_POSIX_signals_Wait_queue,
- THREAD_QUEUE_DISCIPLINE_FIFO
- );
-
/* XXX status codes */
/*
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 001ae7947a..12f02df6d1 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -233,7 +233,7 @@ static bool _POSIX_Threads_Create_extension(
api->signals_unblocked = executing_api->signals_unblocked;
}
- _Thread_queue_Initialize( &api->Join_List, THREAD_QUEUE_DISCIPLINE_FIFO );
+ _Thread_queue_Initialize( &api->Join_List );
_Watchdog_Preinitialize( &api->Sporadic_timer, _Per_CPU_Get_by_index( 0 ) );
_Watchdog_Initialize(
@@ -261,8 +261,9 @@ static void _POSIX_Threads_Terminate_extension(
*/
value_ptr = (void **) executing->Wait.return_argument;
- while ( (the_thread = _Thread_queue_Dequeue( &api->Join_List )) )
- *(void **)the_thread->Wait.return_argument = value_ptr;
+ while ( ( the_thread = _POSIX_Threads_Join_dequeue( api ) ) ) {
+ *(void **)the_thread->Wait.return_argument = value_ptr;
+ }
if ( api->schedpolicy == SCHED_SPORADIC )
_Watchdog_Per_CPU_remove_relative( &api->Sporadic_timer );
diff --git a/cpukit/posix/src/pthreadexit.c b/cpukit/posix/src/pthreadexit.c
index 6f8a7a72d6..e2ae806654 100644
--- a/cpukit/posix/src/pthreadexit.c
+++ b/cpukit/posix/src/pthreadexit.c
@@ -48,11 +48,11 @@ void _POSIX_Thread_Exit(
* Process join
*/
if ( api->detachstate == PTHREAD_CREATE_JOINABLE ) {
- unblocked = _Thread_queue_Dequeue( &api->Join_List );
+ unblocked = _POSIX_Threads_Join_dequeue( api );
if ( unblocked ) {
do {
*(void **)unblocked->Wait.return_argument = value_ptr;
- } while ( (unblocked = _Thread_queue_Dequeue( &api->Join_List )) );
+ } while ( ( unblocked = _POSIX_Threads_Join_dequeue( api ) ) );
} else {
_Thread_Set_state( the_thread, STATES_WAITING_FOR_JOIN_AT_EXIT );
_Thread_Enable_dispatch();
diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c
index f7361310c4..877c4bda6a 100644
--- a/cpukit/posix/src/pthreadjoin.c
+++ b/cpukit/posix/src/pthreadjoin.c
@@ -69,6 +69,7 @@ on_EINTR:
executing->Wait.return_argument = &return_pointer;
_Thread_queue_Enqueue(
&api->Join_List,
+ POSIX_THREAD_JOIN_TQ_OPERATIONS,
executing,
STATES_WAITING_FOR_JOIN | STATES_INTERRUPTIBLE_BY_SIGNAL,
WATCHDOG_NO_TIMEOUT,
diff --git a/cpukit/posix/src/semaphorecreatesupp.c b/cpukit/posix/src/semaphorecreatesupp.c
index e4187d697d..c527a9b46c 100644
--- a/cpukit/posix/src/semaphorecreatesupp.c
+++ b/cpukit/posix/src/semaphorecreatesupp.c
@@ -47,9 +47,8 @@ int _POSIX_Semaphore_Create_support(
POSIX_Semaphore_Control **the_sem
)
{
- POSIX_Semaphore_Control *the_semaphore;
- CORE_semaphore_Attributes *the_sem_attr;
- char *name;
+ POSIX_Semaphore_Control *the_semaphore;
+ char *name;
/* Sharing semaphores among processes is not currently supported */
if (pshared != 0)
@@ -86,8 +85,6 @@ int _POSIX_Semaphore_Create_support(
the_semaphore->linked = false;
}
- the_sem_attr = &the_semaphore->Semaphore.Attributes;
-
/*
* POSIX does not appear to specify what the discipline for
* blocking tasks on this semaphore should be. It could somehow
@@ -95,14 +92,12 @@ int _POSIX_Semaphore_Create_support(
* thing is certain, no matter what we decide, it won't be
* the same as all other POSIX implementations. :)
*/
- the_sem_attr->discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO;
-
- /*
- * This effectively disables limit checking.
- */
- the_sem_attr->maximum_count = 0xFFFFFFFF;
-
- _CORE_semaphore_Initialize( &the_semaphore->Semaphore, the_sem_attr, value );
+ _CORE_semaphore_Initialize(
+ &the_semaphore->Semaphore,
+ CORE_SEMAPHORE_DISCIPLINES_FIFO,
+ 0xFFFFFFFF,
+ value
+ );
/*
* Make the semaphore available for use.
diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c
index a78e88cef0..8f5693b58c 100644
--- a/cpukit/posix/src/sigtimedwait.c
+++ b/cpukit/posix/src/sigtimedwait.c
@@ -156,7 +156,7 @@ int sigtimedwait(
executing->Wait.return_argument = the_info;
_Thread_queue_Enqueue_critical(
&_POSIX_signals_Wait_queue.Queue,
- _POSIX_signals_Wait_queue.operations,
+ POSIX_SIGNALS_TQ_OPERATIONS,
executing,
STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL,
interval,