[ECOS] httpd/monitor problem

Andrew Lunn andrew.lunn@ascom.ch
Thu May 15 12:04:00 GMT 2003


On Thu, May 15, 2003 at 12:54:58PM +0200, Daniel Lidsten wrote:
> Maybe i have misunderstod but the below function expects a thread as
> input since its parameter is a pointer. I assume that the function
> returns the next thread AFTER the one that was sent into the function?

Yep, that is the intention. 

> However, in the monitor.c, the following code is present (see below). It
> calls the cyg_thread_get_next function with both thread and id set to
> zero. Probably the usage of the above function is wrong...?

Nope. Thats how you are supposed to get the first entry. The assertion
checks are wrong as far as i can see. Try this patch. Not tested, not
even compiled.......

     Andrew

Index: packages/kernel//current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/ChangeLog,v
retrieving revision 1.101
diff -u -r1.101 ChangeLog
--- packages/kernel//current/ChangeLog  6 May 2003 16:10:14 -0000       1.101
+++ packages/kernel//current/ChangeLog  15 May 2003 11:56:24 -0000
@@ -1,3 +1,10 @@
+2003-05-15  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+       * src/common/kapi.cxx (cyg_thread_get_next): Passing in a NULL
+       current thread is the way to start. But NULL fulls the class
+       check. Moved the assert to after we know we have a non NULL
+       current.
+
 2003-05-05  Gary Thomas  <gary@mlbassoc.com>
 
        * tests/tm_basic.cxx: Support new option controlling number of times
Index: packages/kernel//current/src/common/kapi.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/kernel/current/src/common/kapi.cxx,v
retrieving revision 1.21
diff -u -r1.21 kapi.cxx
--- packages/kernel//current/src/common/kapi.cxx        28 Jan 2003 05:07:01 -0000      1.21
+++ packages/kernel//current/src/common/kapi.cxx        15 May 2003 11:56:24 -0000
@@ -331,20 +331,22 @@
     Cyg_Scheduler::lock();
 
     Cyg_Thread *thread = (Cyg_Thread *)*current;
-    CYG_ASSERT_CLASSC( thread );
     if( *current == 0 )
     {
         thread = Cyg_Thread::get_list_head();
         *current = (cyg_handle_t)thread;
         *id = thread->get_unique_id();
     }
-    else if( (thread->get_unique_id() == *id) &&
-             (thread = thread->get_list_next()) != NULL )
-    {
-        CYG_CHECK_DATA_PTRC( thread );
+    else {
         CYG_ASSERT_CLASSC( thread );
-        *current = (cyg_handle_t)thread;
-        *id = thread->get_unique_id();
+        if( (thread->get_unique_id() == *id) &&
+             (thread = thread->get_list_next()) != NULL )
+        {
+            CYG_CHECK_DATA_PTRC( thread );
+            CYG_ASSERT_CLASSC( thread );
+            *current = (cyg_handle_t)thread;
+            *id = thread->get_unique_id();
+        }
     }
     else
     {


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list