source: rtems/cpukit/score/src/threadqextractfifo.c @ 215ccce

4.115
Last change on this file since 215ccce was 215ccce, checked in by Sebastian Huber <sebastian.huber@…>, on 08/23/13 at 09:52:01

score: PR2140: _Thread_queue_Extract()

Return if the executing context performed the extract operation since
interrupts may interfere.

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[d4d7899]1/**
2 * @file
[dfbfa2b0]3 *
[d4d7899]4 * @brief Removes a Thread from a Thread  Queue
[dfbfa2b0]5 *
[d4d7899]6 * @ingroup ScoreThreadQ
7 */
8
9/*
[3168deaa]10 *  COPYRIGHT (c) 1989-2008.
[dfbfa2b0]11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
[dd687d97]15 *  http://www.rtems.com/license/LICENSE.
[dfbfa2b0]16 */
17
[a8eed23]18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
[a112364]22#include <rtems/score/threadqimpl.h>
[5618c37a]23#include <rtems/score/chainimpl.h>
24#include <rtems/score/isrlevel.h>
25#include <rtems/score/threadimpl.h>
[4b48ece0]26#include <rtems/score/watchdogimpl.h>
[dfbfa2b0]27
[215ccce]28bool _Thread_queue_Extract_fifo(
[ba42d22]29  Thread_queue_Control *the_thread_queue __attribute__((unused)),
[dfbfa2b0]30  Thread_Control       *the_thread
31)
32{
33  ISR_Level level;
34
35  _ISR_Disable( level );
36
37  if ( !_States_Is_waiting_on_thread_queue( the_thread->current_state ) ) {
38    _ISR_Enable( level );
[215ccce]39    return false;
[dfbfa2b0]40  }
41
42  _Chain_Extract_unprotected( &the_thread->Object.Node );
43
[96d0b64]44  the_thread->Wait.queue = NULL;
45
[dfbfa2b0]46  if ( !_Watchdog_Is_active( &the_thread->Timer ) ) {
47    _ISR_Enable( level );
48  } else {
49    _Watchdog_Deactivate( &the_thread->Timer );
50    _ISR_Enable( level );
51    (void) _Watchdog_Remove( &the_thread->Timer );
52  }
53
54  _Thread_Unblock( the_thread );
55
56#if defined(RTEMS_MULTIPROCESSING)
57  if ( !_Objects_Is_local_id( the_thread->Object.id ) )
58    _Thread_MP_Free_proxy( the_thread );
59#endif
[05279b84]60
[215ccce]61  return true;
[dfbfa2b0]62}
Note: See TracBrowser for help on using the repository browser.