source: rtems/cpukit/score/src/threaditerate.c @ 2afb22b

5
Last change on this file since 2afb22b was d271c3bb, checked in by Sebastian Huber <sebastian.huber@…>, on 10/31/16 at 12:37:59

rtems: Add rtems_task_iterate()

Update #2423.

  • Property mode set to 100644
File size: 1.2 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
21void _Thread_Iterate(
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            i;
31
32#if !defined(RTEMS_POSIX_API)
33    if ( _Objects_Information_table[ api_index ] == NULL ) {
34      continue;
35    }
36#endif
37
38    information = _Objects_Information_table[ api_index ][ 1 ];
39
40    if ( information == NULL ) {
41      continue;
42    }
43
44    for ( i = 1 ; i <= information->maximum ; ++i ) {
45      Thread_Control *the_thread;
46
47      the_thread = (Thread_Control *) information->local_table[ i ];
48
49      if ( the_thread != NULL ) {
50        bool done;
51
52        done = (* visitor )( the_thread, arg );
53
54        if ( done ) {
55          return;
56        }
57      }
58    }
59  }
60}
Note: See TracBrowser for help on using the repository browser.