RTEMS
threaditerate.c
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 #ifdef HAVE_CONFIG_H
16 #include "config.h"
17 #endif
18 
19 #include <rtems/score/threadimpl.h>
20 
22  Thread_Visitor visitor,
23  void *arg
24 )
25 {
26  int api_index;
27 
28  for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; ++api_index ) {
29  const Objects_Information *information;
30  Objects_Maximum maximum;
31  Objects_Maximum index;
32 
33  _Assert( _Objects_Information_table[ api_index ] != NULL );
34  information = _Objects_Information_table[ api_index ][ 1 ];
35 
36  if ( information == NULL ) {
37  continue;
38  }
39 
40  maximum = _Objects_Get_maximum_index( information );
41 
42  for ( index = 0 ; index < maximum ; ++index ) {
43  Thread_Control *the_thread;
44 
45  the_thread = (Thread_Control *) information->local_table[ index ];
46 
47  if ( the_thread != NULL ) {
48  bool done;
49 
50  done = (* visitor )( the_thread, arg );
51 
52  if ( done ) {
53  return;
54  }
55  }
56  }
57  }
58 }
#define OBJECTS_APIS_LAST
Definition: object.h:183
static __inline__ Objects_Maximum _Objects_Get_maximum_index(const Objects_Information *information)
Returns the maximum index of the specified object class.
Definition: objectimpl.h:642
Objects_Information **const _Objects_Information_table[OBJECTS_APIS_LAST+1]
uint16_t Objects_Maximum
Definition: object.h:86
Objects_Control ** local_table
This points to the table of local object control blocks.
Definition: objectdata.h:195
The information structure used to manage each API class of objects.
Definition: objectdata.h:176
void _Thread_Iterate(Thread_Visitor visitor, void *arg)
Calls the visitor with all threads and the given argument until it is done.
Definition: threaditerate.c:21
Inlined Routines from the Thread Handler.
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:100