source: rtems/cpukit/score/src/threadblockingoperationcancel.c @ 2d7ae960

4.115
Last change on this file since 2d7ae960 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: 2.2 KB
Line 
1/*
2 *  Cancel Thread Blocking Operation
3 *
4 *
5 *  COPYRIGHT (c) 1989-2007.
6 *  On-Line Applications Research Corporation (OAR).
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.rtems.com/license/LICENSE.
11 */
12
13#if HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <rtems/system.h>
18#include <rtems/score/thread.h>
19#if defined(RTEMS_DEBUG)
20#include <rtems/score/interr.h>
21#endif
22
23void _Thread_blocking_operation_Cancel(
24#if defined(RTEMS_DEBUG)
25  Thread_blocking_operation_States  sync_state,
26#else
27  Thread_blocking_operation_States  sync_state __attribute__((unused)),
28#endif
29  Thread_Control                   *the_thread,
30  ISR_Level                         level
31)
32{
33  /*
34   *  Cases that should not happen and why.
35   *
36   *  THREAD_BLOCKING_OPERATION_SYNCHRONIZED:
37   *
38   *  This indicates that someone did not enter a blocking
39   *  operation critical section.
40   *
41   *  THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED:
42   *
43   *  This indicates that there was nothing to cancel so
44   *  we should not have been called.
45   */
46
47  #if defined(RTEMS_DEBUG)
48    if ( (sync_state == THREAD_BLOCKING_OPERATION_SYNCHRONIZED) ||
49         (sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED) ) {
50      _Internal_error_Occurred(
51        INTERNAL_ERROR_CORE,
52        true,
53        INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL
54      );
55    }
56  #endif
57
58  /*
59   * The thread is not waiting on anything after this completes.
60   */
61  the_thread->Wait.queue = NULL;
62
63  /*
64   *  If the sync state is timed out, this is very likely not needed.
65   *  But better safe than sorry when it comes to critical sections.
66   */
67  if ( _Watchdog_Is_active( &the_thread->Timer ) ) {
68    _Watchdog_Deactivate( &the_thread->Timer );
69    _ISR_Enable( level );
70    (void) _Watchdog_Remove( &the_thread->Timer );
71  } else
72    _ISR_Enable( level );
73
74  /*
75   *  Global objects with thread queue's should not be operated on from an
76   *  ISR.  But the sync code still must allow short timeouts to be processed
77   *  correctly.
78   */
79
80  _Thread_Unblock( the_thread );
81
82#if defined(RTEMS_MULTIPROCESSING)
83  if ( !_Objects_Is_local_id( the_thread->Object.id ) )
84    _Thread_MP_Free_proxy( the_thread );
85#endif
86
87}
Note: See TracBrowser for help on using the repository browser.