Vampyre Imaging Library Forum

Imaging Category => Help & Questions => Topic started by: FireStarter on 8 March 2008, 23:48:04

Title: thread-safe?
Post by: FireStarter on 8 March 2008, 23:48:04
Hi there, really impressive library.

Question (couldn't find anything related): is it fully thread-safe? 
That is, I don't expect manipulations on the same image to be thread-safe (I would use my own locking for that), but would an image browser be able to load images using different threads (for faster loading with multicores, and for smoothness of the GUI)? I mean, would the internals of the image loaders conflict between instances in other threads?

Thanks
Title: Re: thread-safe?
Post by: Galfar on 12 March 2008, 11:59:52
Well, short answer is: not thread-safe.
I think most of the operations could be used concurrently but
there are some that use some global variables and structures
(I can remember color reduction but there are others).
If you would only load images most loaders should be safe.
PNG/MNG/JNG loader is not safe currently but that could be fixed
easily. I don't know about loaders that use 3rd party libraries
(JPEG, JPEG2000, TIFF).

It would be great if you could try it and report image loaders that cause problems
so I could look at them. I really don't have much time these days.

Imaging 0.3x will be thread-safe but that is still a long way from being released.
Title: Re: thread-safe?
Post by: Galfar on 14 March 2008, 15:16:48
I've fixed some concurrency issues in Network Graphics (PNG/MNG/JNG) and Portable Maps loaders (PAN, PBM, PPM, ...). JPEG, JPEG2000, and TIFF loaders all seem to work fine.

Updated code is in the SVN repository.
Title: Re: thread-safe?
Post by: FireStarter on 20 March 2008, 06:42:09
Nice, will try it, thank you