[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Writing a proxy server - how "non-reentrant" is lwip ra
From: |
wurzel |
Subject: |
Re: [lwip-users] Writing a proxy server - how "non-reentrant" is lwip raw API? |
Date: |
Tue, 14 Jun 2011 21:47:11 -0700 |
Leon Woestenberg wrote:
> On Wed, Jun 15, 2011 at 2:13 AM, wurzel <address@hidden> wrote:
>>
>> My question is, can I call tcp_write from within a tcp_recv
>> callback? In this code, I've opened a pair of TCP pcbs and
>> each one's state struct has a "mate" field that points to
>> the other side's state struct to I can get its pcb.
>>
> I think that's a very good question indeed, because we give no
> explicit guarantee in our documentation that this is guaranteed to
> work, AFAIK. A function is called reentrant if it can be interrupted
> and called again before previous calls complete execution. Now, as
> there are global variables in the stack, we cannot easily guarantee
> reentrancy, other than through code validation.
Thanks for the clear answer; that helps a lot. I don't have interrupts,
but I was worried about the case "A subroutine that is directly or
indirectly recursive should be reentrant" not knowing which routines
might be shared between those paths.
http://en.wikipedia.org/wiki/Reentrant_(computing)
I will now go hunt elsewhere for the cause of my sporadic behavior. :-)
-wurzel