I tried Criticalsection, but get the following errors despite adding
SyncObjs to the uses. Do I need to add somthing else?
main.pas(44,3) Error: Identifier not found "InitializeCriticalSection"
============================
uses
{cthreads,}
Classes, SysUtils,passqlite,BlckSock, synsock, dataparse,SyncObjs;
var
Sock:TTCPBlockSocket;
ClientSock:TSocket;
MyCriticalSection: TRTLCriticalSection;
type
TTCPEchoThrd = class(TThread)
private
Sock:TTCPBlockSocket;
CSock: TSocket;
procedure DataParse;
S:String;
public
Constructor Create (hsock:tSocket);
procedure Execute; override;
end;
procedure TTCPEchoThrd.Execute;
begin
sock:=TTCPBlockSocket.create;
InitializeCriticalSection(MyCriticalSection);
try
Sock.socket:=CSock;
sock.GetSins;
with sock do
begin
repeat
if terminated then break;
S := RecvString(strToInt(dtimeout1));
if lastError<>0 then break;
EnterCriticalSection(MyCriticalSection);
try
SendString(S+#13);
TMyDataParse1.Create(S);
finally
LeaveCriticalSection(MyCriticalSection);
end;
if lastError<>0 then break;
until false;
end;
finally
Sock.Free;
end;
end;
----- Original Message -----
From: "theo" <[EMAIL PROTECTED]>
To: "Ararat Synapse" <[email protected]>
Sent: Tuesday, December 05, 2006 10:31 AM
Subject: Re: [Synalist] newbie console app question
>
>>
>> When I run this code any data stops be processed at synchronize
>>
>>
> Don't use synchronize in console apps. You could use a CriticalSection.
> Btw. Why do you call "resume" in the Execute procedure?
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> synalist-public mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/synalist-public
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public