hello, can someone help me with multithread problem ? we use lwip 1.4.1 in PLC products, and if it live through long time(1 month for example) testing in industry use, I will back here to report.
*our problem* we use multithread select mode in our system, and it "seems" it's ok till now(1 days passed), but I see the doc in rawapi.txt,"/Netconn or Socket Api are not reentrant at the control bolck granularity level/" . so I really cannot figure out if im doing right thing. *our application background/restriction* a, our system is RTOS based , we need 2 TCP clients(separately connecting to 2 TCP servers, i.e., 2 lasers), 1 TCP server(deal with max of 4 remote clients,i.e.,4 modbus clients ), and 1 web server. b, lwip related thread cannot be in polling mode, for here is already a polling thread in RTOS and it has "soft real time" requirements. c, current lwip version is 1.4.1(we are evaluating 2.0.0) d, we need to send data to tcp servers periodically, 10 ms *our design/implementation * 3 thread has used 'select' , but the same socket is only closed by the thread who created it. here is details, we use 'select' in "user tcp client send thread" ,we first call 'connect',and then call 'select' to determine whether the socket is connected correctly or not; if some errors detected in connecting or data sending, we call 'close' to close the socket. we use 'select' in "user tcp client receive thread", blocked forever waiting for data, and call 'recvfrom' if data received, if some errors detected in this thread,we don't just clost the socket ,but send message to "user tcp client send thread" and tell it to close. we use 'select' in "user tcp server thread",listening for incoming requests, receiving and responding(sending) data. *our doubt* 1、 ‘select’ can be used in multithread or not? if yes, the first param maxfdp1 of lwip_select() must be set to the total number of sockets in each thread? for example,in our situation, maxfdp1 = 2(clients) + 4(remote clients) + 1(listen socket) in each select? 2、is SYS_ARCH_PROTECT must be used in multithread? 3、if lwip 1.4.1 does not support the multithread select mode, does lwip 2.0.0 supports it? Thanks a lot ! -- View this message in context: http://lwip.100.n7.nabble.com/LwIP-multithread-select-mode-problems-tp26561.html Sent from the lwip-users mailing list archive at Nabble.com. _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
