Index: packages/kernel/current/ChangeLog =================================================================== RCS file: /cvs/ecos/ecos/packages/kernel/current/ChangeLog,v retrieving revision 1.112 diff -u -r1.112 ChangeLog --- packages/kernel/current/ChangeLog 13 Oct 2003 17:20:18 -0000 1.112 +++ packages/kernel/current/ChangeLog 8 Dec 2003 19:18:00 -0000 @@ -1,3 +1,13 @@ +2003-12-08 Dan Jakubiec + + * src/common/kapi.cxx: Added new function cyg_thread_get_id(). + This function returns the unique thread ID for a given thread + handle. + + * include/kapi.h: Added function prototype for cyg_thread_get_id(). + + * doc/kernel.sgml: Added documentation for cyg_thread_get_id(). + 2003-10-13 Nick Garnett * src/common/clock.cxx (Cyg_Counter::tick): Changed code to deal Index: packages/kernel/current/doc/kernel.sgml =================================================================== RCS file: /cvs/ecos/ecos/packages/kernel/current/doc/kernel.sgml,v retrieving revision 1.6 diff -u -r1.6 kernel.sgml --- packages/kernel/current/doc/kernel.sgml 22 Jan 2003 06:38:59 -0000 1.6 +++ packages/kernel/current/doc/kernel.sgml 8 Dec 2003 19:18:02 -0000 @@ -1278,6 +1278,7 @@ cyg_thread_measure_stack_usage cyg_thread_get_next cyg_thread_get_info + cyg_thread_get_id cyg_thread_find Get basic thread information @@ -1319,6 +1320,10 @@ cyg_thread_info *info + cyg_uint16 cyg_thread_get_id + cyg_handle_t thread + + cyg_handle_t cyg_thread_find cyg_uint16 id @@ -1403,6 +1408,10 @@ +cyg_thread_get_id returns the unique thread ID for +the thread identified by thread. + + cyg_thread_find returns a handle for the thread whose ID is id. If no such thread exists, a zero handle is returned. @@ -1420,6 +1429,9 @@ any time after the specified thread has been created, but measuring stack usage involves looping over at least part of the thread's stack so this should normally only be done from thread context. +cyg_thread_get_id may be called from any context +as long as the caller can guarantee that the supplied thread handle +remains valid. Index: packages/kernel/current/include/kapi.h =================================================================== RCS file: /cvs/ecos/ecos/packages/kernel/current/include/kapi.h,v retrieving revision 1.18 diff -u -r1.18 kapi.h --- packages/kernel/current/include/kapi.h 12 Dec 2002 18:31:44 -0000 1.18 +++ packages/kernel/current/include/kapi.h 8 Dec 2003 19:18:03 -0000 @@ -229,6 +229,8 @@ cyg_uint16 id, cyg_thread_info *info ); +cyg_uint16 cyg_thread_get_id( cyg_handle_t thread ); + cyg_handle_t cyg_thread_find( cyg_uint16 id ); /*---------------------------------------------------------------------------*/ Index: packages/kernel/current/src/common/kapi.cxx =================================================================== RCS file: /cvs/ecos/ecos/packages/kernel/current/src/common/kapi.cxx,v retrieving revision 1.22 diff -u -r1.22 kapi.cxx --- packages/kernel/current/src/common/kapi.cxx 20 May 2003 08:56:43 -0000 1.22 +++ packages/kernel/current/src/common/kapi.cxx 8 Dec 2003 19:18:03 -0000 @@ -236,6 +236,11 @@ return (cyg_handle_t)Cyg_Thread::self(); } +externC cyg_uint16 cyg_thread_get_id( cyg_handle_t thread) +{ + return ((Cyg_Thread *)thread)->get_unique_id(); +} + // idle thread is not really a plain CygThread; danger. externC cyg_handle_t cyg_thread_idle_thread() {