source: rtems/cpukit/score/src/threadqextractwithproxy.c @ 7552e77c

4.11
Last change on this file since 7552e77c was 7552e77c, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 18, 2013 at 12:25:49 PM

score: PR2151: _Thread_queue_Extract_with_proxy()

Avoid NULL pointer access.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 *  @brief _Thread_queue_Extract_with_proxy
3 *
4 *  This routine extracts the_thread from the_thread_queue
5 *  and ensures that if there is a proxy for this task on
6 *  another node, it is also dealt with. A proxy is a data
7 *  data that is on the thread queue on the remote node and
8 *  acts as a proxy for the local thread. If the local thread
9 *  was waiting on a remote operation, then the remote side
10 *  of the operation must be cleaned up.
11 */
12
13/*
14 *  COPYRIGHT (c) 1989-2012.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.org/license/LICENSE.
20 */
21
22#if HAVE_CONFIG_H
23#include "config.h"
24#endif
25
26#include <rtems/score/threadqimpl.h>
27#include <rtems/score/objectimpl.h>
28#include <rtems/score/statesimpl.h>
29
30bool _Thread_queue_Extract_with_proxy(
31  Thread_Control       *the_thread
32)
33{
34  Thread_queue_Control *the_thread_queue;
35
36  #if defined(RTEMS_MULTIPROCESSING)
37    States_Control state;
38
39    state = the_thread->current_state;
40    if ( _States_Is_waiting_for_rpc_reply( state ) &&
41         _States_Is_locally_blocked( state ) ) {
42      Objects_Information                  *the_information;
43      Objects_Thread_queue_Extract_callout  proxy_extract_callout;
44
45      the_information = _Objects_Get_information_id( the_thread->Wait.id );
46      proxy_extract_callout = the_information->extract;
47
48      if ( proxy_extract_callout != NULL )
49        (*proxy_extract_callout)( the_thread );
50    }
51  #endif
52
53  the_thread_queue = the_thread->Wait.queue;
54  if ( the_thread_queue != NULL ) {
55    return _Thread_queue_Extract( the_thread_queue, the_thread );
56  } else {
57    return false;
58  }
59}
Note: See TracBrowser for help on using the repository browser.