This is the mail archive of the ecos-discuss@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]

Re: fileio: scheduler locks in select()


"Joerg Troeger" <jtroeger@nortelnetworks.com> writes:

> The function select()
> 1. locks the scheduler (line # 203),
> 2. calls the wait()-function of the condition variable "semawait" (line #
> 218)
> 3. unlocks the scheduler (line # 240)
> 
> This raises an assertion at line #756 in mutex.cxx (rev 1.8), because of
> calling wait_inner() with non-zero scheduler lock.

Yes. A new feature of the kernel is that we can now call these
functions with a non-zero scheduler lock. However the assertions
weren't changed to keep pace. We have already fixed this here and it
will be in the next anoncvs release. For now just remove any such
assertions.

> 
> In line # 226 of select.cxx there is a return macro without
> unlocking the scheduler first.
> 

Oops! Quite right. Here's a patch:



Index: ChangeLog
===================================================================
RCS file: /cvs/ecc/ecc/io/fileio/current/ChangeLog,v
retrieving revision 1.10
diff -u -5 -r1.10 ChangeLog
--- ChangeLog	2000/08/22 22:21:21	1.10
+++ ChangeLog	2000/08/31 13:49:01
@@ -1,5 +1,10 @@
+2000-08-31  Nick Garnett  <nickg@cygnus.co.uk>
+
+	* src/select.cxx (select): Added scheduler unlock in timeout
+	return case.
+
 2000-08-22  Jonathan Larmour  <jlarmour@redhat.co.uk>
 
 	* doc/fileio.txt: Add Nick's text description of plug-in filesystems
  	and sockets here for now.
 
Index: src/select.cxx
===================================================================
RCS file: /cvs/ecc/ecc/io/fileio/current/src/select.cxx,v
retrieving revision 1.2
diff -u -5 -r1.2 select.cxx
--- src/select.cxx	2000/07/25 14:52:05	1.2
+++ src/select.cxx	2000/08/31 13:49:01
@@ -221,10 +221,11 @@
                     // or past the timeout, return zero. Otherwise return
                     // EINTR, since we have been released.
                     if( Cyg_Clock::real_time_clock->current_value() >= ticks )
                     {
                         select_mutex.unlock();
+                        Cyg_Scheduler::unlock();
                         FILEIO_RETURN_VALUE(0);
                     }
                     else error = EINTR;
                 }
             }


-- 
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK

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