David Shmelzer wrote:
I converted all my code to netconn api and it works, but is a bit
slower.
If I wanted to convert it all to the raw API how do I send to the raw
API from a separate task?
Can I safely call tcp_write from a separate task?
Absolutely not!
I noticed there's work being done on "locking" the core code to make it
thread safe. Is this safe to use yet?
That's another issue! To keep it simple, the core is not (and never will
be) protected agains concurrent access (apart from the memory allocation
functions). The locking you read about is just the method how higher
layer APIs use the core. Until now, the core is handled from one single
thread only (aka the tcpip_thread, because of the loop-function's name)
and application threads using the socket/netconn API communicate with it
through message boxes. Although Frédéric started another approach by
taking a big lock when using the core functions, this is not really
supported yet *and it will never be* for the raw API, I guess.
What you can do to use the raw API from another thread is to get
tcpip_callback call a function (with void argument) in the core thread's
thread-context. This is the same mechanism the other APIs use the core.
However, you cannot mix the socket/netconn/raw APIs, and you should be
aware that raw API callbacks are always called from the tcpip_thread.
Simon
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users