Using Multiple images (and threads)
jcupitt at gmail.com
jcupitt at gmail.com
Thu Jul 17 05:31:14 EDT 2014
Hi Derek,
On 17 July 2014 10:12, Derek Magee <D.R.Magee at leeds.ac.uk> wrote:
> bool check_openslide()
> {
> unsigned int timeout=0 ;
>
> while(m_dont_do_openslide_operation && timeout<100){
> Sleep(25) ;
> timeout++ ;
> } ;
>
> if(timeout==100) return false ;
>
> return true ;
> }
Help! That's not a proper mutex and you will get crashes, especially
with heavy threading.
You need a threading library. I use glib myself:
https://developer.gnome.org/glib/2.40/glib-Threads.html
It's fast, free, good quality, and works on Windows, Linux, OS X,
FreeBSD, and probably others. openslide uses glib too, so there is no
extra dependency, you can just call it.
You could also consider using a higher-level image library. I maintain vips:
http://www.vips.ecs.soton.ac.uk/index.php?title=VIPS
It can load and save images via openslide and will handle all the
threading and memory issues for you. You could (probably) write your
program in ruby or python.
http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use
John
More information about the openslide-users
mailing list