source: rtems/cpukit/score/src/threadblockingoperationcancel.c @ e3f6d35

4.10
Last change on this file since e3f6d35 was 145cf60e, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/31/08 at 03:33:08

Remove nested include.
Add attribute((unused)) to unused function args.

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