Changeset d8752860 in rtems


Ignore:
Timestamp:
May 11, 2015, 12:56:12 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
aa05cfbb
Parents:
9052f88
git-author:
Sebastian Huber <sebastian.huber@…> (05/11/15 12:56:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/19/15 10:00:48)
Message:

score: Add static initializers for thread queues

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/threadqimpl.h

    r9052f88 rd8752860  
    2121
    2222#include <rtems/score/threadq.h>
     23#include <rtems/score/chainimpl.h>
     24#include <rtems/score/rbtreeimpl.h>
    2325#include <rtems/score/thread.h>
    2426
     
    343345);
    344346
     347#if defined(RTEMS_SMP)
     348  #define THREAD_QUEUE_FIFO_INITIALIZER( designator, name ) { \
     349      .Queues = { \
     350        .Fifo = CHAIN_INITIALIZER_EMPTY( designator.Queues.Fifo ) \
     351      }, \
     352      .operations = &_Thread_queue_Operations_FIFO, \
     353      .Lock = ISR_LOCK_INITIALIZER( name ) \
     354    }
     355
     356  #define THREAD_QUEUE_PRIORIY_INITIALIZER( designator, name ) { \
     357      .Queues = { \
     358        .Priority = RBTREE_INITIALIZER_EMPTY( designator.Queues.Priority ) \
     359      }, \
     360      .operations = &_Thread_queue_Operations_priority, \
     361      .Lock = ISR_LOCK_INITIALIZER( name ) \
     362    }
     363#else
     364  #define THREAD_QUEUE_FIFO_INITIALIZER( designator, name ) { \
     365      .Queues = { \
     366        .Fifo = CHAIN_INITIALIZER_EMPTY( designator.Queues.Fifo ) \
     367      }, \
     368      .operations = &_Thread_queue_Operations_FIFO \
     369    }
     370
     371  #define THREAD_QUEUE_PRIORIY_INITIALIZER( designator, name ) { \
     372      .Queues = { \
     373        .Priority = RBTREE_INITIALIZER_EMPTY( designator.Queues.Priority ) \
     374      }, \
     375      .operations = &_Thread_queue_Operations_priority \
     376    }
     377#endif
     378
    345379RTEMS_INLINE_ROUTINE void _Thread_queue_Destroy(
    346380  Thread_queue_Control *the_thread_queue
  • testsuites/sptests/spthreadq01/init.c

    r9052f88 rd8752860  
    1919const char rtems_test_name[] = "SPTHREADQ 1";
    2020
     21static Thread_queue_Control fifo_queue =
     22  THREAD_QUEUE_FIFO_INITIALIZER( fifo_queue, "FIFO" );
     23
     24static Thread_queue_Control prio_queue =
     25  THREAD_QUEUE_PRIORIY_INITIALIZER( prio_queue, "Prio" );
     26
    2127static rtems_task Init(
    2228  rtems_task_argument ignored
     
    3036  _Thread_Enable_dispatch();
    3137  /* is there more to check? */
     38
     39  rtems_test_assert( _Chain_Is_empty( &fifo_queue.Queues.Fifo ) );
     40  rtems_test_assert( fifo_queue.operations == &_Thread_queue_Operations_FIFO );
     41
     42  rtems_test_assert( _RBTree_Is_empty( &fifo_queue.Queues.Priority ) );
     43  rtems_test_assert(
     44    prio_queue.operations == &_Thread_queue_Operations_priority
     45  );
    3246
    3347  TEST_END();
Note: See TracChangeset for help on using the changeset viewer.