This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: ecos sync problem: Does it work well?
- From: Jonathan Larmour <jifl at eCosCentric dot com>
- To: 张 亮 <johnsonest at hotmail dot com>
- Cc: gary dot thomas at mind dot be, ecos-discuss at sources dot redhat dot com,nickg at calivar dot demon dot co dot uk
- Date: Wed, 05 Mar 2003 14:07:05 +0000
- Subject: Re: [ECOS] ecos sync problem: Does it work well?
- References: <F43k7WuEiZoWkolTFh10002b899@hotmail.com>
张 亮 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