[ECOS] ECOS: fatal error!
zhlg_shuhan
zhlg_shuhan@sina.com
Wed Jun 26 03:54:00 GMT 2002
>Iztok zupet wrote :
>Hi
>
> I think, that You just can't access the scheduler queue from an interrupt
>(ISR) routine! No way. What you need to do is to write a DSR for Your ISR and
>in that DSR You can only set up a driver condition to notify a normal thread
>waiting for it, which can access the scheduler queue after the condition
>becomes true.
>Only a normal thread can access the scheduler queue, if You want to be safe,
>not the ISR (interrupt service routine) or DSR (deferred service routine).
>
>Regards
>iz
>
hello!
Can I call bin_sem::post() in a interrupt routine(ISR/DSR)?
if I can ,you see,
void Cyg_Binary_Semaphore::post()
{
// Prevent preemption
Cyg_Scheduler::lock();
CYG_INSTRUMENT_BINSEM( POST, this, 0 );
state = true;
if( !queue.empty() ) {
// The queue is non-empty, so grab the next
// thread from it and wake it up. The waiter
// will clear the flag.
Cyg_Thread *thread = queue.dequeue();
thread->set_wake_reason( Cyg_Thread::DONE );
thread->wake();
CYG_INSTRUMENT_BINSEM( WAKE, this, thread );
}
// Unlock the scheduler and maybe switch threads
Cyg_Scheduler::unlock();
}
so thread->wake() was called,which was listed:
void
Cyg_Thread::wake()
{
CYG_REPORT_FUNCTION();
CYG_INSTRUMENT_THREAD(WAKE,this,Cyg_Scheduler::current_thread);
// Prevent preemption
Cyg_Scheduler::lock();
if( 0 != (state & SLEEPSET) )
{
// Set the state
state &= ~SLEEPSET;
// remove from any queue we were on
remove();
// If the thread is now runnable, return it to run queue
if( state == RUNNING )
Cyg_Scheduler::scheduler.add_thread(this);
}
// Unlock the scheduler and maybe switch threads
Cyg_Scheduler::unlock();
CYG_REPORT_RETURN();
}
remove()was called,so threadQueue race conditions occur!!!
Right?
zhlg
______________________________________
===================================================================
ÃÃÃÃÃâ·ÃµçÃÃÃÃÃä (http://mail.sina.com.cn)
ÃÃÃ÷ÃÃà ÃÃ
⣺¶þÃÃÃó¡ÃÃûÃ㬸óöÃÃñ¾Ã³öÃã¡ (http://classad.sina.com.cn/2shou/)
--
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