[ECOS] ecos sync problem: Does it work well?

Jonathan Larmour jifl@eCosCentric.com
Wed Mar 5 14:07:00 GMT 2003


ÕÅ ÁÁ wrote:
> Gary,
>    maybe you make mistakes.i am level-headed!

But we could spend a lot of time looking at code with nothing wrong with
it just because someone thinks there might be. If you think there's a bug,
prove it! :-)

[scheduler is locked here]
> 
>> >     if (timo) {
>> >         sleep_time = cyg_current_time() + timo;
>> >        if (!cyg_semaphore_timed_wait(&ev->sem, sleep_time)) {
>> > /**********lock will >1,never wait!!!*****************************/
>>
>> Wrong; read the scheduling code - it handle this case properly.
> 
> //////// this is cyg_semaphore_timed_wait(..) lock =2///////////////////

Actually you're looking at either cnt_sem2.cxx or an old version of
cnt_sem.cxx. kapi.cxx uses cnt_sem.cxx.

But whichever version you are thinking of, the code works fine because in
the scheduler's unlock_inner, it will see the thread is now marked as
sleeping and do the reschedule anyway regardless of scheduler lock.

So, believe us now? :-)

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


-- 
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