source: rtems/cpukit/rtems/src/eventtimeout.c @ 20f54e9

4.104.114.84.95
Last change on this file since 20f54e9 was cc2bc302, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 23:06:03

Split Event Manager into one routine per file.

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