Re: [Crystal-cvs] SF.net SVN: crystal:[38283] CS/branches/soc2012/lighter2/apps/tools/ lighter2

res <[email protected]>
Newsgroups gmane.comp.graphics.crystalspace.devel
Message-ID <[email protected]>
On 07.07.2012 14:13, Steel Style wrote:
>>> Actually... why lock the material (data) at all?
>>> In theory, since you only access the image data for reading, concurrency
>>> shouldn't be an issue...
>>>
>>> -f.r.
>>>
> Yeah it's true in theory, but in pratice the
> RadMaterial::GetTextureValue which should be read-only
> change our textureImg member by making a copy of the read data to
> textureImg->rawData member.
> And this is the pointer returned by the ((*textureImg->GetImageData()).
> So as we will work on this
> pointer we should lock it or the data will be inconsistent.

It's probably cleaner to require iImage->GetImageData() to be
thread-safe. (It pretends to be a getter method, and it's reasonable to
assume getters to be thread-safe, IMO.)
There aren't much iImage implementations in CS, so the effort required
is probably not that much.

A cheaper approach would be to simply call GetImageData() once in
situation when you now there's only one thread accessing the material
(e.g. material instance set-up). This will preempt any lazy
initializations (which are potentially conflicting) GetImageData() may
do. (At least in the case of the current CS iImage implementations.)

-f.r.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
Crystal-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-develop
signature.asc (application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/4TjcACgkQNCTzcE/07exMlQCfd313DVknLOGuN39LHOTLrQs2
9gYAnjb3ZTRfZjdn7G3hVRV21uX7IwnQ
=NHNV
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.