William "Chops" Westfield escreveu: > On Jun 13, 2009, at 1:50 PM, Isaac Marino Bavaresco wrote: > > = >>> In general, I would not expect ANY functions in a normal PIC C = >>> library >>> to be reenterant (multi-threading safe) unless explicitly documented >>> to be so; >>> = > > = >> The problem may arise for functions that deal with the control >> registers, which have fixed addresses and FreeRTOS doesn't save/ = >> restore. >> = > > I'd expect the problems to be most likely to show up when global data = > structures (like buffers for a serial port) are involved. Typical = > buffer code like: > txbuffer[outptr++] =3D char; > wont normally contain primitives to protect them against some other = > process doing the same thing at the same time. And it must, if the OS = > is really preemptive. > > BillW > = This is basic, usually the designer must ensure only one task uses each resource (serial port, etc.) at any given time (just one task use each resource ever or using a mutex/open, close, etc.). Even when just one task uses a resource but for instance the task fills the buffer and an interrupt empties it, the designer must encapsulate the accesses inside critical sections. Regards, Isaac __________________________________________________ Fa=E7a liga=E7=F5es para outros computadores com o novo Yahoo! Messenger = http://br.beta.messenger.yahoo.com/ = -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist