OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [src/] [eventtimeout.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: eventtimeout.c,v 1.2 2001-09-27 11:59:19 chris Exp $
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
 
37
void _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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.