Article View: borland.public.cppbuilder.nativeapi
Article #14092Re: Calling a function from ServiceExecute.
From: Remy Lebeau (TeamB)
Date: Tue, 26 Aug 2003 19:00
Date: Tue, 26 Aug 2003 19:00
56 lines
2747 bytes
2747 bytes
"MWP" <mwp@overclockers.com.au> wrote in message
news:3f4b8e1f$1@newsgroups.borland.com...
> void execute_cc2(bool *Terminated, TServiceThread *Thread)
> {
> while (!*Terminated)
> {
> //does stuff
> Sleep(10);
> Thread->ProcessRequests(false)
> }
> }
That will not work. You should change the Terminated parameter to take a
TService* pointer instead of a bool* pointer:
void execute_cc2(TService *Service, TServiceThread *Thread)
{
while( !Service->Terminated )
{
//does stuff
Sleep(10);
Thread->ProcessRequests(false);
}
}
Even better, since TService has a public ServiceThread property, you can do
away with execute_cc2's Thread parameter altogether:
void execute_cc2(TService *Service)
{
while( !Service->Terminated )
{
//does stuff
Sleep(10);
Service->ServiceThread->ProcessRequests(false);
}
}
> BTW... whats the difference between a "Property" and a variable then?
A property is not a variable. It may happen to use a variable internally,
but it is actually a couple of getter/setter methods instead that perform
operations when invoked. A variable is just a block of memory. In your
original code, you were trying to take an address of a class method, not a
raw variable.
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/03
Technical Details
Message-ID:
<3f4bae6c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!205.215.62.125.MISMATCH!in.100proofnews.com!in.100proofnews.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f4b40bb$1@newsgroups.borland.com> <3f4b87cd@newsgroups.borland.com> <3f4b8e1f$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,cccee033616271b2 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-26 12:13:06 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f4b40bb$1@newsgroups.borland.com> <3f4b87cd@newsgroups.borland.com> <3f4b8e1f$1@newsgroups.borland.com> Subject: Re: Calling a function from ServiceExecute. Date: Tue, 26 Aug 2003 12:00:59 -0700 Lines: 58 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3f4bae6c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1061924460 207.175.226.26 (26 Aug 2003 12:01:00 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!205.215.62.125.MISMATCH!in.100proofnews.com!in.100proofnews.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail