source: rtems/cpukit/rtems/src/eventtimeout.c @ 4bf1801

4.104.114.84.95
Last change on this file since 4bf1801 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

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