source: rtems/cpukit/score/src/threadqenqueuefifo.c @ 25f5730f

4.115
Last change on this file since 25f5730f was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief  Thread queue Enqueue FIFO
5 *  @ingroup ScoreThreadQ
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2008.
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/isrlevel.h>
24
25Thread_blocking_operation_States _Thread_queue_Enqueue_fifo (
26  Thread_queue_Control *the_thread_queue,
27  Thread_Control       *the_thread,
28  ISR_Level            *level_p
29)
30{
31  Thread_blocking_operation_States sync_state;
32  ISR_Level                        level;
33
34  _ISR_Disable( level );
35
36    sync_state = the_thread_queue->sync_state;
37    the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_SYNCHRONIZED;
38    if (sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED) {
39      _Chain_Append_unprotected(
40        &the_thread_queue->Queues.Fifo,
41        &the_thread->Object.Node
42      );
43      the_thread->Wait.queue = the_thread_queue;
44
45      the_thread_queue->sync_state = THREAD_BLOCKING_OPERATION_SYNCHRONIZED;
46      _ISR_Enable( level );
47      return THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED;
48    }
49
50  /*
51   *  An interrupt completed the thread's blocking request.
52   *  For example, the blocking thread could have been given
53   *  the mutex by an ISR or timed out.
54   *
55   *  WARNING! Returning with interrupts disabled!
56   */
57  *level_p = level;
58  return sync_state;
59}
Note: See TracBrowser for help on using the repository browser.