public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: [ECOS] Blocking restricted in DSRs
@ 2004-07-27 16:28 Neundorf, Alexander
  2004-07-27 16:48 ` Nick Garnett
  0 siblings, 1 reply; 5+ messages in thread
From: Neundorf, Alexander @ 2004-07-27 16:28 UTC (permalink / raw)
  To: Nick Garnett, ecos-discuss




> > while (1)                //thread main loop
> > {
> >   cyg_drv_dsr_lock();    //does the order of the dsr_lock() 
> and mutex_lock() calls matter ?
> >   cyg_mutex_lock(mutex);
> >   while (queue.isEmpty())
> >     cyg_cond_timed_wait(condition);
> >   Item *i=queue.pop();       
> >   cyg_mutex_unlock(mutex);    
> >   cyg_drv_dsr_unlock();
> >   //do something with i
> >   ...
> > }
> 
> Yep, that's the sort of thing you need to do. In general the regions
> during which cyg_drv_dsr_lock() is used should be kept as small as
> possible. In the above example it makes little difference, but if
> there is work that can be done with just the mutex locked, then that
> should be done before calling cyg_drv_dsr_lock(). 

Ok, seems to work.
Nevertheless I had another look at the code.
For ecos with kernel cyg_drv_dsr_lock() is #defined to cyg_scheduler_lock().
So the scheduler should be locked.
I didn't find the line of code which unlocks the scheduler again, it must be in Cyg_Condition_Variable::wait_inner(), ain't it ?
Otherwise the scheduler would be locked as long as the thread is inside cyg_cond_timed_wait() and no other thread could ever send the signal.
I must be missing something..

Bye
Alex

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [ECOS] Blocking restricted in DSRs
@ 2004-07-26 21:27 Miguel J. Vega
  2004-07-26 23:08 ` Bob Koninckx
  0 siblings, 1 reply; 5+ messages in thread
From: Miguel J. Vega @ 2004-07-26 21:27 UTC (permalink / raw)
  To: ecos-discuss

Hi everyone,

I have read that DSRs should not include calling functions that "block".
What exactly is meant by "blocking"?

Thanks,

Miguel J. Vega
FEGI C&DH Team
University of Michigan

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

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

end of thread, other threads:[~2004-07-27 15:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-27 16:28 [ECOS] Blocking restricted in DSRs Neundorf, Alexander
2004-07-27 16:48 ` Nick Garnett
  -- strict thread matches above, loose matches on Subject: below --
2004-07-26 21:27 Miguel J. Vega
2004-07-26 23:08 ` Bob Koninckx
2004-07-26 23:53   ` Gary Thomas

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).