diff packages/kernel/current/src/sync/cnt_sem.cxx @ 115:6ed91473a1cd ecos-sw-2000-08-21

Merge from eCos master repository on 2000-08-21-22:40:54-BST
author jlarmour
date Fri, 25 Aug 2000 17:32:38 +0000
parents bf00f99aec69
children e0c0827131d1
line wrap: on
line diff
--- a/packages/kernel/current/src/sync/cnt_sem.cxx
+++ b/packages/kernel/current/src/sync/cnt_sem.cxx
@@ -97,10 +97,8 @@ cyg_bool Cyg_Counting_Semaphore::wait()
 
         CYG_INSTRUMENT_CNTSEM( WAIT, this, 0 );
 
-        CYG_ASSERT( Cyg_Scheduler::get_sched_lock() == 1, "Called with non-zero scheduler lock");
-        
-        Cyg_Scheduler::unlock();
-        Cyg_Scheduler::lock();
+        // Allow other threads to run
+        Cyg_Scheduler::reschedule();
 
         CYG_INSTRUMENT_CNTSEM( WOKE, this, count );
 
@@ -166,11 +164,8 @@ Cyg_Counting_Semaphore::wait( cyg_tick_c
 
         CYG_INSTRUMENT_CNTSEM( WAIT, this, 0 );
 
-        CYG_ASSERT( Cyg_Scheduler::get_sched_lock() == 1,
-                    "Called with non-zero scheduler lock");
-        
-        Cyg_Scheduler::unlock();
-        Cyg_Scheduler::lock();
+        // Allow other threads to run
+        Cyg_Scheduler::reschedule();
 
         CYG_INSTRUMENT_CNTSEM( WOKE, this, count );
 
@@ -264,7 +259,7 @@ void Cyg_Counting_Semaphore::post()
 // -------------------------------------------------------------------------
 // Get current count value
 
-cyg_count32 Cyg_Counting_Semaphore::peek()
+cyg_count32 Cyg_Counting_Semaphore::peek() const
 {
     // This is a single read of the value of count.
     // This is already atomic, hence there is no need