source: rtems/cpukit/score/src/threadwaitgetid.c @ fce900b5

5
Last change on this file since fce900b5 was e366f77, checked in by Sebastian Huber <sebastian.huber@…>, on 01/31/17 at 07:08:24

score: Add _Thread_queue_Object_name

Add the special thread queue name _Thread_queue_Object_name to mark
thread queues embedded in an object with identifier. Using the special
thread state STATES_THREAD_QUEUE_WITH_IDENTIFIER is not reliable for
this purpose since the thread wait information and thread state are
protected by different SMP locks in separate critical sections. Remove
STATES_THREAD_QUEUE_WITH_IDENTIFIER.

Add and use _Thread_queue_Object_initialize().

Update #2858.

  • Property mode set to 100644
File size: 959 bytes
Line 
1/*
2 * Copyright (c) 2016, 2017 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
21Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread )
22{
23  const Thread_queue_Queue *queue;
24
25#if defined(RTEMS_MULTIPROCESSING)
26  if ( _States_Is_waiting_for_rpc_reply( the_thread->current_state ) ) {
27    return the_thread->Wait.remote_id;
28  }
29#endif
30
31  queue = the_thread->Wait.queue;
32
33  if ( queue != NULL && queue->name == _Thread_queue_Object_name ) {
34    const Thread_queue_Object *queue_object;
35
36    queue_object = THREAD_QUEUE_QUEUE_TO_OBJECT( queue );
37    return queue_object->Object.id;
38  }
39
40  return 0;
41}
Note: See TracBrowser for help on using the repository browser.