I finally tracked down an intermittent bug I was having -- strings
constructed via snprintf() were being corrupted.  The problem turned out to
be that I was also calling snprintf() within an interrupt service routine
that was executed once per second.  snprintf() calls vsnprintf(), which
stashes a pointer and a length in external variables.  So of course when an
interrupt which calls snprintf() happens to land in the middle of a call to
snprintf(), the string gets corrupted.

Is it, in general, a bad idea to call library routines from ISRs, or is this
an isolated case?

Thanks,
Todd

Reply via email to