🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Thread synchronisation - Question

#13600
From: Bob Gonder
Date: Tue, 07 Oct 2003 01:42
19 lines
2155 bytes
Remy Lebeau (TeamB) wrote:

>"Matt Heling" <heli@nospamheling.de> wrote in message
>> But I've read, especially TCanvas-Objects were "lockable"
>> using the method Lock() to avoid other running threads's
>> access until Unlock() is called after having painted to the
>> Canvas directly.
>
>That does not mean that the underlying drawing is going to be thread-safe
>even with locking.  It depends on the actual device being drawn to whether
>multithread-drawing to it is supported.  In my experience, drawing to a
>Canvas from multiple threads doesn't usually work correctly.

Probably best to use 3 canvases.
Thread draws on #1 while GUI displays #3.
Thread finishes with #1, posts message to GUI telling it to use #1.
Thread starts drawing #2. (Gui likely hasn't finished with #3 yet, but
will shortly, when it get the posted message).
Cycle endlessly through the 3 canvases.
Technical Details
Message-ID: <b764ovs48k5s6v9r3n5q093pq498ej8dvt@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news-xfer2.atl.newshosting.com!63.218.45.10.MISMATCH!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f704989@newsgroups.borland.com> <3f750c0d$2@newsgroups.borland.com> <3f818e8c@newsgroups.borland.com> <3f8198e0$1@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-10-06 19:10:11 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Thread synchronisation - Question
Date: Mon, 06 Oct 2003 18:42:01 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <b764ovs48k5s6v9r3n5q093pq498ej8dvt@4ax.com>
References: <3f704989@newsgroups.borland.com> <3f750c0d$2@newsgroups.borland.com> <3f818e8c@newsgroups.borland.com> <3f8198e0$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.176.44
X-Trace: newsgroups.borland.com 1065490923 67.31.176.44 (6 Oct 2003 18:42:03 -0700)
Lines: 21
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news-xfer2.atl.newshosting.com!63.218.45.10.MISMATCH!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail