avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] printf_P is not reenterable


From: Alexey Boyko
Subject: [avr-libc-dev] printf_P is not reenterable
Date: Fri, 25 Aug 2006 14:33:15 +0300
User-agent: KMail/1.9.3

I found, that printf_P (and other xxprintf_P) is not reenterable. 
(I am using some sort of thread switching library)

problem is in this lines:
stdout->flags |= __SPGM;
stdout->flags &= ~__SPGM;

I've solve this by adding this function body in program:

int printf_P(const char *fmt, ...)
{
  va_list ap;
  int i;

  va_start(ap, fmt);
  //stdout->flags |= __SPGM;
  i = vfprintf(stdout, fmt, ap);
  //stdout->flags &= ~__SPGM;
  va_end(ap);

  return i;
}

and initialization of stdout (I'm not using other then _P versions of printf):

stdout->flags |= __SPGM;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]