source: rtems/cpukit/score/src/threadqdequeuefifo.c @ 7fa97181

Last change on this file since 7fa97181 was a6eef8b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:52:48

2003-09-04 Joel Sherrill <joel@…>

  • apiext.c, chain.c, coremsg.c, coremsgbroadcast.c, coremsgclose.c, coremsgflush.c, coremsgflushsupp.c, coremsgflushwait.c, coremsginsert.c, coremsgseize.c, coremsgsubmit.c, coremutex.c, coremutexflush.c, coremutexseize.c, coremutexsurrender.c, coresem.c, coresemflush.c, coresemseize.c, coresemsurrender.c, coretod.c, coretodset.c, coretodtickle.c, coretodtoseconds.c, coretodvalidate.c, heap.c, heapallocate.c, heapextend.c, heapfree.c, heapgetinfo.c, heapsizeofuserarea.c, heapwalk.c, interr.c, isr.c, mpci.c, object.c, objectallocate.c, objectallocatebyindex.c, objectclearname.c, objectcomparenameraw.c, objectcomparenamestring.c, objectcopynameraw.c, objectcopynamestring.c, objectextendinformation.c, objectfree.c, objectget.c, objectgetbyindex.c, objectgetisr.c, objectgetnext.c, objectgetnoprotection.c, objectinitializeinformation.c, objectmp.c, objectnametoid.c, objectshrinkinformation.c, thread.c, threadchangepriority.c, threadclearstate.c, threadclose.c, threadcreateidle.c, threaddelayended.c, threaddispatch.c, threadevaluatemode.c, threadget.c, threadhandler.c, threadidlebody.c, threadinitialize.c, threadloadenv.c, threadmp.c, threadq.c, threadqdequeue.c, threadqdequeuefifo.c, threadqdequeuepriority.c, threadqenqueue.c, threadqenqueuefifo.c, threadqenqueuepriority.c, threadqextract.c, threadqextractfifo.c, threadqextractpriority.c, threadqextractwithproxy.c, threadqfirst.c, threadqfirstfifo.c, threadqfirstpriority.c, threadqflush.c, threadqtimeout.c, threadready.c, threadreset.c, threadresettimeslice.c, threadrestart.c, threadresume.c, threadrotatequeue.c, threadsetpriority.c, threadsetstate.c, threadsettransient.c, threadstackallocate.c, threadstackfree.c, threadstart.c, threadstartmultitasking.c, threadsuspend.c, threadtickletimeslice.c, threadyieldprocessor.c, userext.c, watchdog.c, watchdogadjust.c, watchdoginsert.c, watchdogremove.c, watchdogtickle.c, wkspace.c: URL for license changed.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  Thread Queue Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/score/chain.h>
17#include <rtems/score/isr.h>
18#include <rtems/score/object.h>
19#include <rtems/score/states.h>
20#include <rtems/score/thread.h>
21#include <rtems/score/threadq.h>
22#include <rtems/score/tqdata.h>
23
24/*PAGE
25 *
26 *  _Thread_queue_Dequeue_fifo
27 *
28 *  This routine removes a thread from the specified threadq.
29 *
30 *  Input parameters:
31 *    the_thread_queue - pointer to threadq
32 *
33 *  Output parameters:
34 *    returns - thread dequeued or NULL
35 *
36 *  INTERRUPT LATENCY:
37 *    check sync
38 *    FIFO
39 */
40
41Thread_Control *_Thread_queue_Dequeue_fifo(
42  Thread_queue_Control *the_thread_queue
43)
44{
45  ISR_Level              level;
46  Thread_Control *the_thread;
47
48  _ISR_Disable( level );
49  if ( !_Chain_Is_empty( &the_thread_queue->Queues.Fifo ) ) {
50
51    the_thread = (Thread_Control *)
52       _Chain_Get_first_unprotected( &the_thread_queue->Queues.Fifo );
53
54    if ( !_Watchdog_Is_active( &the_thread->Timer ) ) {
55      _ISR_Enable( level );
56      _Thread_Unblock( the_thread );
57    } else {
58      _Watchdog_Deactivate( &the_thread->Timer );
59      _ISR_Enable( level );
60      (void) _Watchdog_Remove( &the_thread->Timer );
61      _Thread_Unblock( the_thread );
62    }
63
64#if defined(RTEMS_MULTIPROCESSING)
65    if ( !_Objects_Is_local_id( the_thread->Object.id ) )
66      _Thread_MP_Free_proxy( the_thread );
67#endif
68
69    return the_thread;
70  }
71
72  switch ( the_thread_queue->sync_state ) {
73    case THREAD_QUEUE_SYNCHRONIZED:
74    case THREAD_QUEUE_SATISFIED:
75      _ISR_Enable( level );
76      return NULL;
77
78    case THREAD_QUEUE_NOTHING_HAPPENED:
79    case THREAD_QUEUE_TIMEOUT:
80      the_thread_queue->sync_state = THREAD_QUEUE_SATISFIED;
81      _ISR_Enable( level );
82      return _Thread_Executing;
83  }
84  return NULL;                /* this is only to prevent warnings */
85}
86
Note: See TracBrowser for help on using the repository browser.