source: rtems/cpukit/score/src/threadq.c @ 54cf0e34

4.115
Last change on this file since 54cf0e34 was 26f4cdd, checked in by Sebastian Huber <sebastian.huber@…>, on 11/24/14 at 07:35:45

_Scheduler_FIXME_thread_priority_queues_are_broken

Delete this variable since it is no longer necessary due to the thread
priority queue implementation change to use RB trees.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Thread Queue Initialize
5 *  @ingroup ScoreThreadQ
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2014.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/threadqimpl.h>
22#include <rtems/score/chainimpl.h>
23#include <rtems/score/rbtreeimpl.h>
24#include <rtems/score/scheduler.h>
25#include <rtems/score/threadimpl.h>
26
27RBTree_Compare_result _Thread_queue_Compare_priority(
28  const RBTree_Node *left,
29  const RBTree_Node *right
30)
31{
32  Priority_Control left_priority =
33    THREAD_RBTREE_NODE_TO_THREAD( left )->current_priority;
34  Priority_Control right_priority =
35    THREAD_RBTREE_NODE_TO_THREAD( right )->current_priority;
36
37  /*
38   * SuperCore priorities use lower numbers to indicate greater importance.
39   */
40  if ( left_priority == right_priority )
41    return 0;
42  if ( left_priority < right_priority )
43    return -1;
44  return 1;
45}
46
47void _Thread_queue_Initialize(
48  Thread_queue_Control         *the_thread_queue,
49  Thread_queue_Disciplines      the_discipline,
50  States_Control                state,
51  uint32_t                      timeout_status
52)
53{
54  the_thread_queue->state          = state;
55  the_thread_queue->discipline     = the_discipline;
56  the_thread_queue->timeout_status = timeout_status;
57  the_thread_queue->sync_state     = THREAD_BLOCKING_OPERATION_SYNCHRONIZED;
58
59  if ( the_discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY ) {
60    _RBTree_Initialize_empty( &the_thread_queue->Queues.Priority );
61  } else { /* must be THREAD_QUEUE_DISCIPLINE_FIFO */
62    _Chain_Initialize_empty( &the_thread_queue->Queues.Fifo );
63  }
64
65}
Note: See TracBrowser for help on using the repository browser.