Article

From:
To:
David HAROUCHE
Subject:
Re: How threadsafe is TBitmap
Newsgroup:
embarcadero.public.delphi.graphics

Re: How threadsafe is TBitmap

David HAROUCHE wrote:

>>> Better use a private TBitmap to the thread, and give public access 
>>> to a built-shadow TBitmap of it via a property of the Thread....

>> That is not correct. The really confusing part is that even local TBitmap
>> are not thread safe unless you lock them.

> This sounds obvious when working with concurrent processes !

What I meant is that TBitmaps that are declared private to a thread aren't so
private, because they register themselves in a global list which is accessed by
the garbage collector in the mean thread.

Normally locking is only required if an object can be accessed by multiple threads. For TBitmaps you always need locking if you work with them in a thread. Even if you declared them as private or local in a thread method.
Jan Derk
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Fri, 15 Nov 2024 16:36:57 UTC
Copyright © 2009-2024
HREF Tools Corp.