On Feb 17, 10:16 am, Shmuel (Seymour J.) Metz <spamt...@library.lspace.org.invalid> wrote: > In <DmJ5SKFdRQph-pn2-Iu4uIsOT7...@209-142-179-216.dyn.centurytel.net>, > on 02/14/2013 > at 01:46 PM, wil...@nospam.pobox.com (Will Janoschka) said: > > >Then your thread safe code cannot call itself from within itself > > What gives you that idea? A procedure that is recursive and reentrant > will generaly have local data on the stack, but that has nothing to do > with making copies of other data.
Very interesting, and entirely not clear to me personally. I read and I read, but I only remain confused regards this reentrancy. Recursion, not a problem for me.
> >a local copy must be made for anything that changes changing > >global data until final return from current instantiation would > >cause computation that is circular. > > There is no such requirement, and no circularity. There is a > requirement that changes to global data be serialized, but that > applies whether it is done in the middle or just prior to return.
I was advised that global variables, because statics ought be safe, are trouble for reentrant code. Can you please provide a short sample list of which types of codes are reentrant. I understand printf is one. I guess this issue is primarily relevant to event driven logic?
> >For example any part of an general interrupt routine that can be > >interrupted must be reentrant. global variables can be used if > >not changed in this instantiation. > > Interrupt routines often change global data, e.g., dispatch queues. > BTW, they normally need to be reentrant even if they are > noninterruptible, because there may be more than one processor.
I really need a good reference for interrupts and race conditions logic. Any suggestions? Like Doctor McCoy would shout "I'm a reverse engineer, not a computer scientist, DAMN IT?! Just feed me the answer already... Tia."
> -- > Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel> > > Unsolicited bulk E-mail subject to legal action. I reserve the > right to publicly post or ridicule any abusive E-mail. Reply to > domain Patriot dot net user shmuel+news to contact me. Do not > reply to spamt...@library.lspace.org