Article View: borland.public.cppbuilder.nativeapi
Article #4693Re: inherited Create;
From: Remy Lebeau (TeamB)
Date: Fri, 02 Dec 2005 22:52
Date: Fri, 02 Dec 2005 22:52
36 lines
2552 bytes
2552 bytes
"Alistair" <NoSpamPlease@Somewhere.Com> wrote in message news:4390b2cb$1@newsgroups.borland.com... > I can't pass the pointer of a class function to CreateThread Well, technically you can, but not easily. You would essentially have to use a proxy function in order to do it. Using a static method is easier, though, especially since CreateThread() allows a user-defined value to be passed to the thread instance. That makes a proxy function unnecessary. > so I pass a static member with the instance as a parameter 'this'. That is fine. There is nothing wrong with doing that, and that works very well, as my earlier example showed. > I am trying to replicate the pascal version of TThread, and I > want to keep everything tidy inside the class. No external > declarations, etc... I gave you the code to do exactly that. TThread only has two external dependancies - the ThreadProc() function and a global TList for use with the TThread.Synchronize() method. Both of which can be inplemented using static members. > How can i write my code so that I can get Execute of the derived > code to be called instead of the base class Execute, from a base class > function called by the thread? The code I gave you does exactly that. Did you try the code yet? I told you that I did run it and it worked fine. Derived::Execute() was called as expected. Gambit
Technical Details
Message-ID:
<4390d061$3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<438e31c6$1@newsgroups.borland.com> <438e3b10$1@newsgroups.borland.com> <438eb24c$1@newsgroups.borland.com> <438ec656$1@newsgroups.borland.com> <439005f7@newsgroups.borland.com> <4390a5d0$1@newsgroups.borland.com> <4390b2cb$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3e5cce9567b943d3 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <438e31c6$1@newsgroups.borland.com> <438e3b10$1@newsgroups.borland.com> <438eb24c$1@newsgroups.borland.com> <438ec656$1@newsgroups.borland.com> <439005f7@newsgroups.borland.com> <4390a5d0$1@newsgroups.borland.com> <4390b2cb$1@newsgroups.borland.com> Subject: Re: inherited Create; Date: Fri, 2 Dec 2005 14:52:32 -0800 Lines: 38 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: <4390d061$3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1133564001 68.69.17.41 (2 Dec 2005 14:53:21 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail