This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
cyg_thread_delay problem?
- From: =?big5?b?IldhbmcsIEFsdmluICik/al22XkgVEFPKSI=?= <Wang dot Alvin at inventec dot com>
- To: <ecos-discuss at sources dot redhat dot com>
- Date: Thu, 18 Sep 2003 17:43:16 +0800
- Subject: [ECOS] cyg_thread_delay problem?
Hi to all,
I use cyg_thread_delay function but it doesn't work. It returns immediately.
I trace the function and find that when execute Cyg_Scheduler::unlock()
it can't swith to another thread.
void
Cyg_Thread::delay( cyg_tick_count delay)
{
CYG_REPORT_FUNCTION();
#ifdef CYGFUN_KERNEL_THREADS_TIMER
CYG_INSTRUMENT_THREAD(DELAY,this,delay);
// Prevent preemption
Cyg_Scheduler::lock();
sleep();
set_timer( Cyg_Clock::real_time_clock->current_value()+delay, DELAY );
// Unlock the scheduler and maybe switch threads
Cyg_Scheduler::unlock();
// Clear the timeout. It is irrelevant whether the alarm has
// actually gone off or not.
clear_timer();
// and deal with anything else we must do when we return
switch( wake_reason ) {
case DESTRUCT:
case EXIT:
exit();
break;
default:
break;
}
#endif
CYG_REPORT_RETURN();
}
The cyg_current_time() function works correcttly, so the
real time clock also works. So could you tell me what is wrong?
And what should I do?
Thank you very much.
Best Regards,
Alvin Wang ¤ý©vÙy
Software Design Dept. Inventec (TAO)
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss