summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/src/threadlocaliterate.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-06-12 19:57:02 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-06-12 19:57:02 +0000
commit8ef38186faea3d9b5e6f0f1242f668cb7e7a3d52 (patch)
tree9253f150814c99167239f7c2cc850cdd9d92c003 /c/src/exec/score/src/threadlocaliterate.c
parentf481c39c015a71a6747d8e0f4f923fabe1086ffc (diff)
downloadrtems-8ef38186faea3d9b5e6f0f1242f668cb7e7a3d52.tar.bz2
Patch from John Cotton <john.cotton@nrc.ca>, Charles-Antoine Gauthier
<charles.gauthier@iit.nrc.ca>, and Darlene A. Stewart <Darlene.Stewart@nrc.ca> to add support for a number of very significant things: + BSPs for many variations on the Motorola MBX8xx board series + Cache Manager including initial support for m68040 and PowerPC + Rework of mpc8xx libcpu code so all mpc8xx CPUs now use same code base. + Rework of eth_comm BSP to utiltize above. John reports this works on the 821 and 860
Diffstat (limited to 'c/src/exec/score/src/threadlocaliterate.c')
-rw-r--r--c/src/exec/score/src/threadlocaliterate.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/c/src/exec/score/src/threadlocaliterate.c b/c/src/exec/score/src/threadlocaliterate.c
new file mode 100644
index 0000000000..a2d94fe81a
--- /dev/null
+++ b/c/src/exec/score/src/threadlocaliterate.c
@@ -0,0 +1,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;
+}