🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #4123

Re: TIdPeerThread / IdTCPServer1 Multi Treaded problems

#4123
From: Remy Lebeau (TeamB)
Date: Fri, 08 Apr 2005 17:36
26 lines
1824 bytes
"Omar Zelaya" <ozelaya2010@hotmail.com> wrote in message
news:4256a163@newsgroups.borland.com...

> Use the static storage class specifier with a local variable to
> preserve the last value between successive calls to that function.
> A static variable acts like a local variable but has the lifetime of
> an external variable.

It is also stored in global memory, not locally, which is exactly why it
won't work in this situation.

> I think that if you remove static from the Count variable
> declaration, it will work as you expect.

No, it won't.  If Andy does that, the existing value will be lost between
successive calls to his code, which is not what his code is trying to do.

> You can also do this

Deriving a new class from TIdPeerThread is usually better.  No need to
instantiate secondary objects to do the same work that the original thread
object can do directly.


Gambit
Technical Details
Message-ID: <4256c0b9$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <425669ba@newsgroups.borland.com> <4256a163@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,3ba22e438513e68b
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <425669ba@newsgroups.borland.com> <4256a163@newsgroups.borland.com>
Subject: Re: TIdPeerThread / IdTCPServer1 Multi Treaded problems
Date: Fri, 8 Apr 2005 10:36:35 -0700
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <4256c0b9$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1112981689 68.69.17.41 (8 Apr 2005 10:34:49 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail