source: rtems/cpukit/score/src/threadblockingoperationcancel.c @ 7cdaed0d

4.104.114.95
Last change on this file since 7cdaed0d was 7cdaed0d, checked in by Joel Sherrill <joel.sherrill@…>, on 04/28/08 at 18:12:43

2008-04-28 Daron Chabot <daron.chabot@…>

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