🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14434

Re: Synchronization Problems....

#14434
From: Phuoc Can HUA
Date: Thu, 14 Aug 2003 00:53
64 lines
2866 bytes
You can run the loop in a TThread or use TTimer instead of a loop. If you 
use TTimer you have to use some global variables (counter) to control the 
loop. If it's a endless loop then no need to check exit condition. Of 
course it's easier to use TThread because you don't have anything to change 
in your loop construct.

But me ,personally, will avoid TThread because you might encounter some 
conflicts when your program gets complex.

HTH
Phuoc Can HUA

On Wed, 13 Aug 2003 12:06:50 +0200, Keneth Wagner <keneth.wagner@peak- 
system.com> wrote:

> Hi, i'm making a class where i need to wait inside a function for an 
> event.
> The problem is, this event is a Event RX from the Comm Port.  I need to 
> read
> several Messages from the port before let the funtion to continue, so i 
> need
> do something like:
> //---------------------------------------------
> msg GetMessage(){
> while(Not Have all the Message OR TimeOut is Reached){
> Wait.....
> }
>
> return CompleteMessage //Global Variable;
> }
> //---------------------------------------------
> Event Function (Read From the Port Event){
> CompleteMessage += ReadFromtheCommPort();
> }
> /------------------------------------------------------------------------- 
>
>
> --
> -----------------
>
> My problem of course is a While with a ";", so i neever reach the Event
> handler function and my App hang on.  I need only an IDEA because I don't
> have more.
>
> I preciate any, ANY idea.  i made it with WM_USER messages, but i need a 
> way
> to make from other application only "MyLocal = GETSOMETHING()"; where 
> that
> getsomething is a function how wait information from the port for a 
> specific
> time is gone or a message received Without hang on my app.
>
> Thanks, and sorry if my knowlege is not much (in case all this is wrong
> ;-) ).
>
>
>



-- 
_/\__/\__/\__/\__/\__/\_
www.huaonline.com
My Homepage is my Castle
Technical Details
Message-ID: <oprtvd370vbq7az6@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!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f3a0df1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a4a10dc5e85235c0
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-13 18:08:13 PST
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Synchronization Problems....
References: <3f3a0df1@newsgroups.borland.com>
Message-ID: <oprtvd370vbq7az6@newsgroups.borland.com>
Content-Type: text/plain; charset=iso-8859-15; format=flowed
From: Phuoc Can HUA <home}a+t{huaonline.com>
MIME-Version: 1.0
Date: Thu, 14 Aug 2003 10:53:57 +1000
User-Agent: Opera7.10/Win32 M2 build 2840
NNTP-Posting-Host: 203.194.21.162
X-Trace: newsgroups.borland.com 1060822712 203.194.21.162 (13 Aug 2003 17:58:32 -0700)
Lines: 64
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail