source: rtems/cpukit/rtems/src/eventsurrender.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 *  Event Manager
3 *
4 *  COPYRIGHT (c) 1989-2008.
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.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/system.h>
17#include <rtems/rtems/status.h>
18#include <rtems/rtems/event.h>
19#include <rtems/score/isr.h>
20#include <rtems/score/object.h>
21#include <rtems/rtems/options.h>
22#include <rtems/score/states.h>
23#include <rtems/score/thread.h>
24#include <rtems/rtems/tasks.h>
25
26/*
27 *  _Event_Surrender
28 *
29 *  This routines remove a thread from the specified threadq.
30 *
31 *  Input parameters:
32 *    the_thread - pointer to thread to be dequeued
33 *
34 *  Output parameters: NONE
35 *
36 *  INTERRUPT LATENCY:
37 *    before flash
38 *    after flash
39 *    check sync
40 */
41
42void _Event_Surrender(
43  Thread_Control *the_thread
44)
45{
46  ISR_Level           level;
47  rtems_event_set     pending_events;
48  rtems_event_set     event_condition;
49  rtems_event_set     seized_events;
50  rtems_option        option_set;
51  RTEMS_API_Control  *api;
52
53  api = the_thread->API_Extensions[ THREAD_API_RTEMS ];
54
55  option_set = (rtems_option) the_thread->Wait.option;
56
57  _ISR_Disable( level );
58  pending_events  = api->pending_events;
59  event_condition = (rtems_event_set) the_thread->Wait.count;
60
61  seized_events = _Event_sets_Get( pending_events, event_condition );
62
63  /*
64   *  No events were seized in this operation
65   */
66  if ( _Event_sets_Is_empty( seized_events ) ) {
67    _ISR_Enable( level );
68    return;
69  }
70
71  /*
72   *  If we are in an ISR and sending to the current thread, then
73   *  we have a critical section issue to deal with.
74   */
75  if ( _ISR_Is_in_progress() &&
76       _Thread_Is_executing( the_thread ) &&
77       ((_Event_Sync_state == THREAD_BLOCKING_OPERATION_TIMEOUT) ||
78        (_Event_Sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED)) ) {
79    if ( seized_events == event_condition || _Options_Is_any(option_set) ) {
80      api->pending_events = _Event_sets_Clear( pending_events,seized_events );
81      the_thread->Wait.count = 0;
82      *(rtems_event_set *)the_thread->Wait.return_argument = seized_events;
83      _Event_Sync_state = THREAD_BLOCKING_OPERATION_SATISFIED;
84    }
85    _ISR_Enable( level );
86    return;
87  }
88
89  /*
90   *  Otherwise, this is a normal send to another thread
91   */
92  if ( _States_Is_waiting_for_event( the_thread->current_state ) ) {
93    if ( seized_events == event_condition || _Options_Is_any( option_set ) ) {
94      api->pending_events = _Event_sets_Clear( pending_events, seized_events );
95      the_thread->Wait.count = 0;
96      *(rtems_event_set *)the_thread->Wait.return_argument = seized_events;
97
98      _ISR_Flash( level );
99
100      if ( !_Watchdog_Is_active( &the_thread->Timer ) ) {
101        _ISR_Enable( level );
102        _Thread_Unblock( the_thread );
103      } else {
104        _Watchdog_Deactivate( &the_thread->Timer );
105        _ISR_Enable( level );
106        (void) _Watchdog_Remove( &the_thread->Timer );
107        _Thread_Unblock( the_thread );
108      }
109      return;
110    }
111  }
112  _ISR_Enable( level );
113}
Note: See TracBrowser for help on using the repository browser.