This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cyg_drv_dsr_unlock() and non-kernel cfg


Hello

I noticed by looking at the code and then testing it out that in the nonkernel config
a cyg_drv_dsr_unlock() 'closes' so to say any number of previous cyg_drv_dsr_lock()s

so
dsr_lock()
dsr_lock()
...
dsr_lock()
dsr_unlock()

is equivalent to a lock/unlock pair.

Although the docs and the comment above the unlock function says that DSRs will fire only when the count which is incremented by dsr_lock (dsr_disable_counter) is 0, this counter is never decremented in unlock but set to 0 regardless of how large it was.
Is this intended and somehow reflects that in non-kernel mode there's no realistic use for such behaviour or is it really an oversight due to this code not being used much?
Attached is the change that made my small test app behave the same way when compiled with and without the kernel, i.e when the lock count is > 0 DSRs will not be run (except when explicitely called from a cond_wait)


I'd appreciate any comments

thanks
Jani
--- ../../cvs/packages/hal/common/current/src/drv_api.c	2004-04-13 17:38:59.000000000 +0300
+++ hal/common/current/src/drv_api.c	2004-11-23 18:56:49.803121624 +0200
@@ -289,29 +289,29 @@ externC void cyg_drv_dsr_unlock()
 
     do
     {
         if( dsr_disable_counter == 1 )
         {
             call_dsrs();
         }
 
         HAL_REORDER_BARRIER();
         
-        dsr_disable_counter = 0;
+        dsr_disable_counter--;
 
         HAL_REORDER_BARRIER();
 
         // Check that no DSRs have been posted between calling
         // call_dsrs() and zeroing dsr_disable_counter. If so,
         // loop back and call them.
         
-        if( dsr_list != NULL )
+        if( dsr_list != NULL && dsr_disable_counter == 0)
         {
             dsr_disable_counter = 1;
             continue;
         }
 
         CYG_REPORT_RETURN();
         
         return;
         
     } while(1);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]