🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TThread with messages

#16191
From: Remy Lebeau (TeamB)
Date: Mon, 26 May 2003 01:34
26 lines
2351 bytes
"Lapo" <lapoguidi@inwind.it> wrote in message
news:3ed163fb@newsgroups.borland.com...

> But, first of all, it's really better to use messages
> instead of using Synchronize method?

As was previously mentioned, up to and including BCB5, Synchronize() is
implemented to use messages via SendMessage().

The other way in general to do what you ask is to just protect the actual
data with a synchronization object such as a critical section, mutex,
semaphore.  Then you don't have to deal with all this message/Synchronize()
stuff.  Since you can't really protect access to a VCL component using any
of these if the component resides in the main VCL thread (unless the
component itself uses them internally), it would be better to protect access
to the JPG data itself.  Then the retreiving thread can safely update the
data whenever it has new data available, and the VCL thread can safely grab
the currently available data periodically whenever it wants and pass it to
the display component.  Only 1 thread will be able to gain access to the
data any any given time and any other thread that wants access will have to
wait until the other thread already accessing the data has finished its
tasks.


Gambit
Technical Details
Message-ID: <3ed16e86$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3ed00a13@newsgroups.borland.com> <3ed01446$1@newsgroups.borland.com> <3ed0adcc$1@newsgroups.borland.com> <3ed13011@newsgroups.borland.com> <3ed1434d@newsgroups.borland.com> <3ed157dd$1@newsgroups.borland.com> <3ed163fb@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,9f6b69458a9a485d
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-25 18:43:33 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ed00a13@newsgroups.borland.com> <3ed01446$1@newsgroups.borland.com> <3ed0adcc$1@newsgroups.borland.com> <3ed13011@newsgroups.borland.com> <3ed1434d@newsgroups.borland.com> <3ed157dd$1@newsgroups.borland.com> <3ed163fb@newsgroups.borland.com>
Subject: Re: TThread with messages
Date: Sun, 25 May 2003 18:34:27 -0700
Lines: 28
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: 207.175.226.26
Message-ID: <3ed16e86$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1053912710 207.175.226.26 (25 May 2003 18:31:50 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail