blob: a2d94fe81ab74818465bf11e0640ded882ece0e7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*
* Thread Iterator
*
*
* COPYRIGHT (c) 2000.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#include <rtems/system.h>
#include <rtems/score/object.h>
#include <rtems/score/thread.h>
/*PAGE
*
* _Thread_Local_iterate
*
* DESCRIPTION:
*
* This function invokes the callback function for each existing thread.
* Iteration continues until either all threads have been processed, or,
* if break_on_error is TRUE, until an invocation of the callback returns
* an integer value other than 0.
*
* Input parameters:
* callback:
* A pointer to a function with the indicated signature.
* arg:
* A pointer to some arbitrary entity. Passed on to the callback.
* break_on_error
* If TRUE, stop iterating on error.
*
*
* Output parameters: NONE
* But callback may write into space pointed to by arg.
*
* Return value:
* 0 if successful
* Value returned by the callback otherwise.
*/
unsigned32 _Thread_Local_iterate(
unsigned32 (*callback)(Thread_Control *the_thread, void * arg),
void *arg,
boolean break_on_error
)
{
unsigned32 class_index;
unsigned32 result;
Objects_Information *information;
if( callback == NULL )
return 0;
for ( class_index = OBJECTS_CLASSES_FIRST ;
class_index <= OBJECTS_CLASSES_LAST ;
class_index++ ) {
information = _Objects_Information_table[ class_index ];
if ( information && information->is_thread ) {
result = _Objects_Local_iterate(
information,
(unsigned32 (*)(Objects_Control *, void *))callback,
arg,
break_on_error );
if( result && break_on_error )
return result;
}
}
return 0;
}
|