lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Debug code


From: Leon Woestenberg
Subject: Re: [lwip-users] Debug code
Date: Sun, 9 Mar 2003 02:34:54 +0100

----- Original Message -----
From: "Marc Boucher" <address@hidden>

> > DEBUGF(SOCKETS_DEBUG, (" port=%u)\n", ntohs(local_port)));
> >#endif
>
> Btw such debug contructs are also very problematic on systems where
multiple
> tasks simultaneously generate debug output, since other messages can end
up
> being inserted between the multiple print calls resulting in mixed /
> confusing lines.
>
> Better would be to print everything at once using a
> "lwip_bind(%d, addr=%s port=%u)\n" format string with some
inet_addr()-like
> function (minus re-entrancy issues) or macro/token to handle IP address
> formatting.
>
This is not generally true. If the OS can switch tasks pre-emptively, and
printf does not
lock the scheduler, the printf()ing task can simply be switched from the CPU
and a new
printf()ing task can be switched in.

I have solved this by having DEBUGF lock the scheduler, call printf(),
unlock the scheduler.

Leon.






reply via email to

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