summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-21 08:15:27 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-28 06:19:52 +0200
commit34dd90a560454842595845b95b7aed8b871d5da9 (patch)
tree48b660c05f448c3b33a0f095b897ccad96f02280
parentscore: Fix allocation size calculation (diff)
downloadrtems-34dd90a560454842595845b95b7aed8b871d5da9.tar.bz2
score: Gather message queue control initialization
Initialize the structure in a single code block after the error checks and calculations. Update #4007.
-rw-r--r--cpukit/score/src/coremsg.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/cpukit/score/src/coremsg.c b/cpukit/score/src/coremsg.c
index 04c1799c69..0246a3ae77 100644
--- a/cpukit/score/src/coremsg.c
+++ b/cpukit/score/src/coremsg.c
@@ -35,11 +35,6 @@ bool _CORE_message_queue_Initialize(
{
size_t buffer_size;
- the_message_queue->maximum_pending_messages = maximum_pending_messages;
- the_message_queue->number_of_pending_messages = 0;
- the_message_queue->maximum_message_size = maximum_message_size;
- _CORE_message_queue_Set_notify( the_message_queue, NULL );
-
/* Make sure the message size computation does not overflow */
if ( maximum_message_size > MESSAGE_SIZE_LIMIT ) {
return false;
@@ -64,19 +59,12 @@ bool _CORE_message_queue_Initialize(
return false;
}
- /*
- * Initialize the pool of inactive messages, pending messages,
- * and set of waiting threads.
- */
- _Chain_Initialize (
- &the_message_queue->Inactive_messages,
- the_message_queue->message_buffers,
- (size_t) maximum_pending_messages,
- buffer_size
- );
+ the_message_queue->maximum_pending_messages = maximum_pending_messages;
+ the_message_queue->number_of_pending_messages = 0;
+ the_message_queue->maximum_message_size = maximum_message_size;
+ _CORE_message_queue_Set_notify( the_message_queue, NULL );
_Chain_Initialize_empty( &the_message_queue->Pending_messages );
-
_Thread_queue_Object_initialize( &the_message_queue->Wait_queue );
if ( discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY ) {
@@ -85,5 +73,12 @@ bool _CORE_message_queue_Initialize(
the_message_queue->operations = &_Thread_queue_Operations_FIFO;
}
+ _Chain_Initialize (
+ &the_message_queue->Inactive_messages,
+ the_message_queue->message_buffers,
+ (size_t) maximum_pending_messages,
+ buffer_size
+ );
+
return true;
}