This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ecos idle function


Hi Andrew,
    I can break the problem into the following point.
If I start the create idle_thread_main() with a
priority 1, and then run through the code using the
debugger, the code dosent start the new thread. I am
using your code. creating the thread,  resuming it
etc. The current thread has priority 31 and hence
shouldn't interfere with the starting of this new
thread. I even tried suspending the current thread,
hoping that atleast now it will jump to the
idle_thread_main() function. But it dosen't. Here's a
brief part of the code.

///////////
cyg_thread_create(1,
		    idle_thread_main,
		    0,
		    "Calibration idle thread",
		    idle_stack,
		    sizeof(idle_stack),
		    &idleH,
		    &thread);

cyg_clock_to_counter(cyg_real_time_clock(),&counter);
 
cyg_alarm_create(counter,alarm_func,(cyg_addrword_t)idleH,&alarmH,&alarm_s);
  
 
cyg_alarm_initialize(alarmH,cyg_current_time()+10,0);
  cyg_alarm_enable(alarmH);
  
  idle_loops_start = idle_thread_loops;
  
  /* Dont be decieved, remember this is a
multithreaded system ! */
  old_priority =
cyg_thread_get_priority(cyg_thread_self());
  cyg_thread_set_priority(cyg_thread_self(),2);
  cyg_thread_resume(idleH);
  
  
  *calibration = idle_thread_loops - idle_loops_start;
  cyg_alarm_delete(alarmH);
  cyg_thread_kill(idleH);
  cyg_thread_delete(idleH);
 
cyg_thread_set_priority(cyg_thread_self(),old_priority);

/////////////////

The code simply jumps from cyg_thread_resume to the
next line, without jumping into idle_thread_main. I
know this also because I had set break points in
idle_thread_main().

Would really appericiate your feedback.

Thanks,
Milind



--- Andrew Lunn <andrew.lunn@ascom.ch> wrote:
> On Thu, Jan 16, 2003 at 12:14:40PM -0800, Milind
> Kopikare wrote:
> > Hi,
> >    this question has been posted before but I
> didn't
> > quite get the answer. 
> >     In eCos, Andrew Lunn's code should work if in
> idle
> > time we shift to the idle_thread_main function in
> > thread.cxx. But, whenever the processor is idling,
> the
> > code dosent jump there. For want of other tasks to
> do,
> > the processor hangs. 
> 
> Could you explain this is more detail please.
> Something sounds very
> wrong here.
> 
>       Andrew
> 
> -- 
> Before posting, please read the FAQ:
> http://sources.redhat.com/fom/ecos
> and search the list archive:
> http://sources.redhat.com/ml/ecos-discuss
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]