diff packages/kernel/current/include/kapi.h @ 460:a65a4055f146

* src/common/kapi.cxx: * include/kapi.h: Added function cyg_thread_get_next(), cyg_thread_find() and cyg_thread_get_info() to allow the current set of threads to be enumerated, and per-thread information to be retrieved safely. * doc/kernel.sgml: Documented new KAPI calls. * src/common/thread.cxx: Zero unique_id in thread destructor so that a stale thread pointer can be checked for validity. * include/instrmnt.h: Added cyg_instrument_state() to report the current state of an instrumentation flag. Moved ifdef for CYGDBG_KERNEL_INSTRUMENT_MSGS out of within FLAGS ifdef. We can have messages without flags. * src/instrmnt/meminst.cxx: Added cyg_instrument_state() to report the current state of an instrumentation flag. Modified cyg_instrument_msg() in line with header and table changes. * host/instr/dump_instr.c: * host/instr/instrument.sh: * include/instrument_desc.h: Added a final NULL element to the generated table in instrument_desc.h to mark its end. Otherwise code that does not have access to the table definition cannot find its end. Also added ifdefs to allow instrument_desc.h to be used to acquire the structure definition and table pointer.
author nickg
date Thu, 12 Dec 2002 18:31:34 +0000
parents c0d53837cb68
children 1b465c781382
line wrap: on
line diff
--- a/packages/kernel/current/include/kapi.h
+++ b/packages/kernel/current/include/kapi.h
@@ -12,6 +12,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 2002 Bart Veer
+// Copyright (C) 2002 Nick Garnett
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
 //
 // eCos is free software; you can redistribute it and/or modify it under
@@ -207,6 +208,30 @@ cyg_uint32 cyg_thread_measure_stack_usag
 #endif
 
 /*---------------------------------------------------------------------------*/
+/* Thread enumeration and information                                        */
+    
+typedef struct
+{
+    cyg_handle_t        handle;
+    cyg_uint16          id;
+    cyg_uint32          state;
+    char                *name;
+    cyg_priority_t      set_pri;
+    cyg_priority_t      cur_pri;
+    cyg_addrword_t      stack_base;
+    cyg_uint32          stack_size;
+    cyg_uint32          stack_used;
+} cyg_thread_info;
+    
+cyg_bool_t cyg_thread_get_next( cyg_handle_t *thread, cyg_uint16 *id );
+
+cyg_bool_t cyg_thread_get_info( cyg_handle_t thread,
+                                cyg_uint16 id,
+                                cyg_thread_info *info );
+
+cyg_handle_t cyg_thread_find( cyg_uint16 id );
+    
+/*---------------------------------------------------------------------------*/
 /* Per-thread Data                                                           */
 
 #ifdef CYGVAR_KERNEL_THREADS_DATA