Article View: borland.public.cppbuilder.nativeapi
Article #16266Re: TThread with messages
From: Remy Lebeau (TeamB)
Date: Sun, 25 May 2003 00:57
Date: Sun, 25 May 2003 00:57
35 lines
2509 bytes
2509 bytes
"Lapo" <lapoguidi@inwind.it> wrote in message news:3ed00a13@newsgroups.borland.com... > I see that every time the TImage is updated using > Synchronize, as a said before, the Thread seems > freezed until the updating is done. Correct. That is intentional by design. Synchronize() blocks the calling thread until the callback method pased to it is actually executed. This prevents multiple synchronized threads from executing at the same time, such as in scenerios when they are sharing and accessing the same protected resource(s). > Well, I read something about PostMessage/SendMessage > to communicate from Thread to Main Application That is a possibility. However, keep in mind that SendMessage() will also block the calling thread until the message is actually processed (in fact, up to and including BCB5, Synchronize() uses SendMessage() internally). > so the thread can ask the main application to update the > TImage and it doesn't wait for the updating is over. That is possible. PostMessage() would be well suited for that. However, the actual image data will have to be stored somewhere in memory where the main application thread can get to it, and you will have to ensure that you are not modifying the data from your thread at the same time that the main thread is accessing it for display, and that the data is still valid in memory by the time the message is eventually processed. PostMessage() returns immediately, the message queued for later processing when the receiving thread eventually removes the message from its message queue. Gambit
Technical Details
Message-ID:
<3ed01446$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3ed00a13@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-24 17:56:06 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ed00a13@newsgroups.borland.com> Subject: Re: TThread with messages Date: Sat, 24 May 2003 17:57:06 -0700 Lines: 37 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: <3ed01446$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1053824070 207.175.226.26 (24 May 2003 17:54:30 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail