🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Thread synchronisation

#13676
From: Remy Lebeau (TeamB)
Date: Sat, 27 Sep 2003 04:00
30 lines
1867 bytes
"Wim Bekker" <wim@bekker> wrote in message
news:3f704989@newsgroups.borland.com...

> Using a TThread it is not safe to use VCL components.

Not true.  You can use the thread's Synchronize() method to invoke a piece
of code in the context of the main VCL thread instead of the calling thread.
Then you can access VCL components from your thread code.

> But I'm wondering what exactly isn't safe. Are the VCL properties
> at risk, or is the underlying windows structure not safe?

The VCL is not thread-safe, for the most part.

> For instance, is it possible to lock the canvas of a VCL object
> in a thread and paint on it?

No.  Use Synchronize() to access the Canvas.

> Or is it possible to supply the windows handle to a thread to paint on it?

Possibly.

> Or should this all be done in the main thread.

Preferably, anything related to the GUI should be done in the main thread.


Gambit
Technical Details
Message-ID: <3f750c0d$2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f704989@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,20b65b563d927a2d
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-27 01:21:20 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f704989@newsgroups.borland.com>
Subject: Re: Thread synchronisation
Date: Fri, 26 Sep 2003 21:00:14 -0700
Lines: 32
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.1165
NNTP-Posting-Host: 67.23.78.204
Message-ID: <3f750c0d$2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1064635405 67.23.78.204 (26 Sep 2003 21:03:25 -0700)
Path: arc1-ca.pugleaf.net!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail