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

4.11
Last change on this file since 215ccce was 215ccce, checked in by Sebastian Huber <sebastian.huber@…>, on Aug 23, 2013 at 9:52:01 AM

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
Line 
1/**
2 * @file
3 *
4 * @brief Removes a Thread from a Thread  Queue
5 *
6 * @ingroup ScoreThreadQ
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2008.
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
15 *  http://www.rtems.com/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/score/threadqimpl.h>
23#include <rtems/score/chainimpl.h>
24#include <rtems/score/isrlevel.h>
25#include <rtems/score/threadimpl.h>
26#include <rtems/score/watchdogimpl.h>
27
28bool _Thread_queue_Extract_fifo(
29  Thread_queue_Control *the_thread_queue __attribute__((unused)),
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 );
39    return false;
40  }
41
42  _Chain_Extract_unprotected( &the_thread->Object.Node );
43
44  the_thread->Wait.queue = NULL;
45
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
60
61  return true;
62}
Note: See TracBrowser for help on using the repository browser.