Home > Back-end >  On how to solve idtcpserver CurrentReadBuffer delphi7 blocking problem
On how to solve idtcpserver CurrentReadBuffer delphi7 blocking problem

Time:02-03

As title in indy programming, I need to receive the service side with multiple client information, and according to the different results of client information to return
With AThread. Connection do
The begin
Try
//EnterCriticalSection (CS);
Tmpstr:=CurrentReadBuffer;
AThread. The Synchronize (Addtmpstr);
If iRet & gt;=0 then
The begin
Writeln (inttostr (iRet));
End
The else
The begin
Writeln (' failed to match or illegal data);
end;
//LeaveCriticalSection (CS);
TMPSTR, iret for global variables, iret in addtmpstr assignment (related to TMPSTR value), if it is not a critical area will appear the phenomenon of mutual interference between multiple threads (1 as the client is supposed to be received by the value of 2), if a critical area (turn on)//, if one of the client connection is established only and not to send data, the thread will be blocked in TMPSTR:=CurrentReadBuffer; Here, the critical region cannot be freed, other clients won't be able to communicate with the server,

CodePudding user response:

O master!!!!!!!!!!! Is there a way to solve interference between multithreaded is a thread local variable, and don't know how to do?
  • Related