comparison 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
comparison
equal deleted inserted replaced
114:5ad2b71d525e 115:6ed91473a1cd
95 95
96 queue.enqueue( self ); 96 queue.enqueue( self );
97 97
98 CYG_INSTRUMENT_CNTSEM( WAIT, this, 0 ); 98 CYG_INSTRUMENT_CNTSEM( WAIT, this, 0 );
99 99
100 CYG_ASSERT( Cyg_Scheduler::get_sched_lock() == 1, "Called with non-zero scheduler lock"); 100 // Allow other threads to run
101 101 Cyg_Scheduler::reschedule();
102 Cyg_Scheduler::unlock();
103 Cyg_Scheduler::lock();
104 102
105 CYG_INSTRUMENT_CNTSEM( WOKE, this, count ); 103 CYG_INSTRUMENT_CNTSEM( WOKE, this, count );
106 104
107 switch( self->get_wake_reason() ) 105 switch( self->get_wake_reason() )
108 { 106 {
164 162
165 queue.enqueue( self ); 163 queue.enqueue( self );
166 164
167 CYG_INSTRUMENT_CNTSEM( WAIT, this, 0 ); 165 CYG_INSTRUMENT_CNTSEM( WAIT, this, 0 );
168 166
169 CYG_ASSERT( Cyg_Scheduler::get_sched_lock() == 1, 167 // Allow other threads to run
170 "Called with non-zero scheduler lock"); 168 Cyg_Scheduler::reschedule();
171
172 Cyg_Scheduler::unlock();
173 Cyg_Scheduler::lock();
174 169
175 CYG_INSTRUMENT_CNTSEM( WOKE, this, count ); 170 CYG_INSTRUMENT_CNTSEM( WOKE, this, count );
176 171
177 switch( self->get_wake_reason() ) 172 switch( self->get_wake_reason() )
178 { 173 {
262 } 257 }
263 258
264 // ------------------------------------------------------------------------- 259 // -------------------------------------------------------------------------
265 // Get current count value 260 // Get current count value
266 261
267 cyg_count32 Cyg_Counting_Semaphore::peek() 262 cyg_count32 Cyg_Counting_Semaphore::peek() const
268 { 263 {
269 // This is a single read of the value of count. 264 // This is a single read of the value of count.
270 // This is already atomic, hence there is no need 265 // This is already atomic, hence there is no need
271 // to lock the scheduler. 266 // to lock the scheduler.
272 267