source: rtems/cpukit/score/src/threadqtimeout.c @ 59d1127

4.104.114.84.95
Last change on this file since 59d1127 was dfbfa2b0, checked in by Joel Sherrill <joel.sherrill@…>, on 11/02/99 at 20:36:11

Split threadq.c into multiple files.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  Thread Queue Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/score/chain.h>
18#include <rtems/score/isr.h>
19#include <rtems/score/object.h>
20#include <rtems/score/states.h>
21#include <rtems/score/thread.h>
22#include <rtems/score/threadq.h>
23#include <rtems/score/tqdata.h>
24
25/*PAGE
26 *
27 *  _Thread_queue_Timeout
28 *
29 *  This routine processes a thread which timeouts while waiting on
30 *  a thread queue. It is called by the watchdog handler.
31 *
32 *  Input parameters:
33 *    id - thread id
34 *
35 *  Output parameters: NONE
36 */
37
38void _Thread_queue_Timeout(
39  Objects_Id  id,
40  void       *ignored
41)
42{
43  Thread_Control       *the_thread;
44  Thread_queue_Control *the_thread_queue;
45  Objects_Locations     location;
46
47  the_thread = _Thread_Get( id, &location );
48  switch ( location ) {
49    case OBJECTS_ERROR:
50    case OBJECTS_REMOTE:  /* impossible */
51      break;
52    case OBJECTS_LOCAL:
53      the_thread_queue = the_thread->Wait.queue;
54
55      /*
56       *  If the_thread_queue is not synchronized, then it is either
57       *  "nothing happened", "timeout", or "satisfied".   If the_thread
58       *  is the executing thread, then it is in the process of blocking
59       *  and it is the thread which is responsible for the synchronization
60       *  process.
61       *
62       *  If it is not satisfied, then it is "nothing happened" and
63       *  this is the "timeout" transition.  After a request is satisfied,
64       *  a timeout is not allowed to occur.
65       */
66
67      if ( the_thread_queue->sync_state != THREAD_QUEUE_SYNCHRONIZED &&
68           _Thread_Is_executing( the_thread ) ) {
69        if ( the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED )
70          the_thread_queue->sync_state = THREAD_QUEUE_TIMEOUT;
71      } else {
72        the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status;
73        _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
74      }
75      _Thread_Unnest_dispatch();
76      break;
77  }
78}
79
Note: See TracBrowser for help on using the repository browser.