[En-Nut-Discussion] Race condition and stack overflow in tcpsm.c
harald.kipp at egnite.de
Wed Nov 19 16:49:37 CET 2014
On 19.11.2014 16:25, Philipp Burch wrote:
> On 19.11.2014 14:54, Harald Kipp wrote:
>> While Nut/OS is cooperative, mutual exclusion can be done with much less
> I'm aware of the cooperative nature of Nut/OS and the benefits of that,
> but I think that this solution won't be ideal here. The problem only
> arises if two threads try to initialize the TCP state machine "at the
> same time". When the first thread enters the function, it will set the
> flag to 1 indicating that the initialization is complete, which is
> actually a lie.
Oops! Yes, you are perfectly right. My solution won't work.
I'll have to come back to this. For now your mutex solution should
sufficiently fix it.
More information about the En-Nut-Discussion