🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Canvas->CopyRect() conflicting TThread::execute() ?

#17751
From: Phuoc Can HUA
Date: Mon, 03 Mar 2003 23:01
43 lines
2766 bytes
Thanks for your input. But I can only consider this as my last solution
because I have to re-write too much (or not?)
I'm trying to solve it with Semaphore first (see my newer posting).


Phuoc Can HUA

"Oliver Rutsch" <nospam@sympatec.com> wrote in message
news:1046686601.962938@post.sympatec.net...
> Hi Phuoc ,
> [...]
> > execute() (of a TThread) where they are only called in sequence. Now I
have
> > the problem that sometimes (non-deterministic) the colors are wrong
(e.g.
> > reverse). Looks like the CopyMode is set wrongly. But I didn't have this
> > problem before. Unless I'm having the problem of concurrently access of
> > CopyMode. I've been debugging this for weeks :-(
> > May someone could help me.
> >
> > My question:
> > Does this has something to do with combination of CopyRect and TThread?
> > Are all the fuction calls in execute() running in the same thread, no
matter
> > where the function defined?
>
> I had similar problems using the canvas CopyRect functions in a thread.
> In my case it just stopped drawing, although the thread wasn't
> deadlocked. Later I found that the Handle property of the canvas got
> sometimes invalid, no idea why. Even locking the canvas didn't help in
> any way. Don't waste your time with VCL-GUI and multithreading. If you
> need it, use the win32 API functions (GetDC, ReleaseDC, BitBlt aso.), it
> worked very good for me.
> Another approach is to use the Synchronize function, but in this case
> the TTimer solution does the same and is easier.
> To answer your second question, no it doesn't matter where your code was
> defined. If it runs from execute it runs always in the thread.
>
> --
> Dipl. Ing. Oliver Rutsch
> EMail: orutsch at sympatec.com
> Sympatec GmbH Germany
>
Technical Details
Message-ID: <3e63dfff$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!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e5c195c$1@newsgroups.borland.com> <1046686601.962938@post.sympatec.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,61072c08be0db3fa
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-03-04 14:01:27 PST
From: "Phuoc Can HUA" <home+a+t+huaonline.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e5c195c$1@newsgroups.borland.com> <1046686601.962938@post.sympatec.net>
Subject: Re: Canvas->CopyRect() conflicting TThread::execute() ?
Date: Tue, 4 Mar 2003 10:01:18 +1100
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 210.9.89.210
Message-ID: <3e63dfff$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1046732799 210.9.89.210 (3 Mar 2003 15:06:39 -0800)
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!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail