public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] cyg_thread_delay problem?
@ 2003-09-18  4:07 "Wang, Alvin (王宗斌 TAO)"
  0 siblings, 0 replies; 2+ messages in thread
From: "Wang, Alvin (王宗斌 TAO)" @ 2003-09-18  4:07 UTC (permalink / raw)
  To: ecos-discuss


> Hi to all,
> 
> I use cyg_thread_delay function but it doesn't work.
> 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  王宗斌
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ECOS] cyg_thread_delay problem?
@ 2003-09-18  9:43 "Wang, Alvin (王宗斌 TAO)"
  0 siblings, 0 replies; 2+ messages in thread
From: "Wang, Alvin (王宗斌 TAO)" @ 2003-09-18  9:43 UTC (permalink / raw)
  To: ecos-discuss




 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  王宗斌
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-18  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-18  4:07 [ECOS] cyg_thread_delay problem? "Wang, Alvin (王宗斌 TAO)"
2003-09-18  9:43 "Wang, Alvin (王宗斌 TAO)"

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).