source: rtems/cpukit/score/src/iterateoverthreads.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: 829 bytes
Line 
1/**
2 *  @file
3 *
4 *  @brief Iterates Over All Threads
5 *  @ingroup ScoreThread
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2010.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/threadimpl.h>
22
23typedef struct {
24  rtems_per_thread_routine routine;
25} routine_arg;
26
27static bool routine_adaptor( rtems_tcb *tcb, void *arg )
28{
29  routine_arg *ra;
30
31  ra = arg;
32  ( *ra->routine )( tcb );
33  return false;
34}
35
36void rtems_iterate_over_all_threads( rtems_per_thread_routine routine )
37{
38  routine_arg arg = {
39    .routine = routine
40  };
41
42  if ( routine != NULL ) {
43    _Thread_Iterate( routine_adaptor, &arg );
44  }
45}
Note: See TracBrowser for help on using the repository browser.