source: rtems/cpukit/rtems/src/eventtimeout.c @ c18e0ba

4.115
Last change on this file since c18e0ba was c18e0ba, checked in by Alex Ivanov <alexivanov97@…>, on 12/04/12 at 22:59:11

rtems misc: Clean up Doxygen GCI Task #4

http://www.google-melange.com/gci/task/view/google/gci2012/7950205

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Timeout Event
5 *  @ingroup ClassicEvent
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2008.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18  #include "config.h"
19#endif
20
21#include <rtems/rtems/event.h>
22
23void _Event_Timeout(
24  Objects_Id  id,
25  void       *arg
26)
27{
28  Thread_Control                   *the_thread;
29  Objects_Locations                 location;
30  ISR_Level                         level;
31  Thread_blocking_operation_States *sync_state;
32
33  sync_state = arg;
34
35  the_thread = _Thread_Get( id, &location );
36  switch ( location ) {
37
38    case OBJECTS_LOCAL:
39
40      /*
41       *  If the event manager is not synchronized, then it is either
42       *  "nothing happened", "timeout", or "satisfied".   If the_thread
43       *  is the executing thread, then it is in the process of blocking
44       *  and it is the thread which is responsible for the synchronization
45       *  process.
46       *
47       *  If it is not satisfied, then it is "nothing happened" and
48       *  this is the "timeout" transition.  After a request is satisfied,
49       *  a timeout is not allowed to occur.
50       */
51      _ISR_Disable( level );
52        #if defined(RTEMS_DEBUG)
53          if ( !the_thread->Wait.count ) {  /* verify thread is waiting */
54            _Thread_Unnest_dispatch();
55            _ISR_Enable( level );
56            return;
57          }
58        #endif
59
60        the_thread->Wait.count = 0;
61        if ( _Thread_Is_executing( the_thread ) ) {
62          if ( *sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED )
63            *sync_state = THREAD_BLOCKING_OPERATION_TIMEOUT;
64        }
65
66        the_thread->Wait.return_code = RTEMS_TIMEOUT;
67      _ISR_Enable( level );
68      _Thread_Unblock( the_thread );
69      _Thread_Unnest_dispatch();
70      break;
71
72#if defined(RTEMS_MULTIPROCESSING)
73    case OBJECTS_REMOTE:  /* impossible */
74#endif
75    case OBJECTS_ERROR:
76      break;
77  }
78}
Note: See TracBrowser for help on using the repository browser.