Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages
Started by column
Tue, 24 Apr 2007 09:17
atozedsoftware.indy.servers.tcp
Author: column
Date: Tue, 24 Apr 2007 09:17
Date: Tue, 24 Apr 2007 09:17
54 lines
1673 bytes
1673 bytes
Hello, Is it good manner to synchronize TidTCPServer OnConnect, onDisconnect and OnExecute events using critical section as following: procedure Tinterf_TCP.AserverSocketConnect(AContext: TIdContext); begin ......... try EntercriticalSection(cs); Do some job in main thread finally LeaveCriticalSection(cs); end; end; procedure Tinterf_TCP.AserverSocketDisconnect(AContext: TIdContext); begin ......... try EntercriticalSection(cs); Do some job in main thread finally LeaveCriticalSection(cs); end; end; procedure Tinterf_TCP.AserverSocketExecute(AContext: TIdContext); begin ......... try EntercriticalSection(cs); Do some job in main thread finally LeaveCriticalSection(cs); end; end;
Re: atozedsoftware.indy.servers.tcp
Author: Remy Lebeau (TeamB)
Date: Tue, 24 Apr 2007 09:42
Date: Tue, 24 Apr 2007 09:42
16 lines
1436 bytes
1436 bytes
<column@takas.lt> wrote in message news:462dcb2f$1@newsgroups.borland.com... > Is it good manner to synchronize TidTCPServer OnConnect, > onDisconnect and OnExecute events using critical section as following: No, because using a critical section like that is not enough to ensure thread safety with the main thread, especially if UI components are involved. Use the TIdSync class instead. Gambit
Re: atozedsoftware.indy.servers.tcp
Author: column.column
Date: Tue, 24 Apr 2007 11:24
Date: Tue, 24 Apr 2007 11:24
36 lines
1503 bytes
1503 bytes
> No, because using a critical section like that is not enough to ensure
> thread safety with the main thread, especially if UI components are
> involved.
What is UI component?
> Use the TIdSync class instead.
>
I have no experience with this class. How to use it in my case? For example
I would like to log events:
procedure Tinterf_TCP.Logit(info:string);
begin
.........
end;
procedure Tinterf_TCP.AserverSocketConnect(AContext: TIdContext);
begin
.........
Logit('connect')
end;
Re: atozedsoftware.indy.servers.tcp
Author: Remy Lebeau (TeamB)
Date: Tue, 24 Apr 2007 16:11
Date: Tue, 24 Apr 2007 16:11
20 lines
1514 bytes
1514 bytes
<column.column@gmail.com> wrote in message news:462de8f0@newsgroups.borland.com... > What is UI component? UI = user interface. I was referring to any visual component. > I have no experience with this class. Have you looked at the Indy documentation yet? Also, go to http://www.deja.com and search through the newsgroup archives, as examples have been posted many times before. > How to use it in my case? For example I would like to log events: I have posted logging examples many times before. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads