Hi,
On Fri, May 24, 2013 at 07:35:49AM +0200, Furiantes Furiantes wrote:
Is tcp_new() thread safe too ? or just netcon. My scenario is that:
No, as said in doc/rawapi.txt :-)
Raw API is *NOT* thread safe: udp_*(), tcp_*(), netif_*(), ...
Netconn API is thread safe: netconn_*()
Socket API is thread safe: lwip_accept(), lwip_bind(), lwip_connect(), ...
NetifAPI is thread safe: netifapi_*()
- i will call a TCP staff only in seperated threads. Like do_download =
tcp_new() in one thread and than like listen to some port initialized in
seperated thread etc. etc.
Is that ok to do or not ? With global access can I access from TCP_1 thread
to TCP_2 thread like TCP_2 kill TCP_1 thread.
Nah, this is wrong, you *have to* use netconn or socket API.
Also, and this is very important too, Netconn and Socket API are thread
safe against lwIP thread but NOT against themselves, so a UDP or a TCP
PCB must be handled by only one thread. If you want to share a PCB
between threads you can of course add the necessary mutex around Netconn
or Socket calls.
Sylvain
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users