source: rtems/cpukit/score/src/threadwaitgetid.c @ 97312fcc

5
Last change on this file since 97312fcc was 97312fcc, checked in by Sebastian Huber <sebastian.huber@…>, on 04/05/16 at 12:36:30

score: Delete Thread_Wait_information::id

This field was only by the monitor in non-multiprocessing
configurations. Add new field Thread_Wait_information::remote_id in
multiprocessing configurations and use it for the remote procedure call
thread queue.

Add _Thread_Wait_get_id() to obtain the object identifier for debug and
system information tools. Ensure the object layout via static asserts.
Add test cases to sptests/spthreadq01.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 * Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#if HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include <rtems/score/threadimpl.h>
20
21#define THREAD_WAIT_QUEUE_OBJECT_STATES \
22  ( STATES_WAITING_FOR_BARRIER \
23    | STATES_WAITING_FOR_CONDITION_VARIABLE \
24    | STATES_WAITING_FOR_MESSAGE \
25    | STATES_WAITING_FOR_MUTEX \
26    | STATES_WAITING_FOR_RWLOCK \
27    | STATES_WAITING_FOR_SEMAPHORE )
28
29Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread )
30{
31  States_Control current_state;
32
33  current_state = the_thread->current_state;
34
35#if defined(RTEMS_MULTIPROCESSING)
36  if ( ( current_state & STATES_WAITING_FOR_RPC_REPLY ) != 0 ) {
37    return the_thread->Wait.remote_id;
38  }
39#endif
40
41  if ( ( current_state & THREAD_WAIT_QUEUE_OBJECT_STATES ) != 0 ) {
42    const Thread_Wait_queue_object *queue_object;
43
44    queue_object = RTEMS_CONTAINER_OF(
45      the_thread->Wait.queue,
46      Thread_Wait_queue_object,
47      Wait_queue.Queue
48    );
49
50    return queue_object->Object.id;
51  }
52
53  return 0;
54}
Note: See TracBrowser for help on using the repository browser.