Login  Register

ExtendedPlugInFilter, GenericDialog and synchronization

Posted by Adrian Daerr-2 on Jun 27, 2015; 3:28pm
URL: http://imagej.273.s1.nabble.com/ExtendedPlugInFilter-GenericDialog-and-synchronization-tp5013333.html

Hello,

I want to write an ExtendedPlugInFilter with a preview checkbox. For
preview, the API documentation of that interface at
  http://imagej.nih.gov/ij/developer/api/
says that "a separate thread may call setNPasses(nPasses) and run(ip)
while the dialog is displayed". It does not say anything about
synchronization: is this something I need to worry about ?

More specifically, how does the preview thread get its parameters in
run(ip) ? If the GenericDialog is queried from the preview thread, do
I have a guarantee that the values are the same as those seen by the
dialog handling thread ? Otherwise, what is the recommended way of
synchronizing ?

A similar issue arises when plugin returns the PARALLELIZE_IMAGES /
PARALLELIZE_STACKS flags, although one may argue that the dialog has
probably been quit by the time the processing takes places (but the
processing threads might stem from a worker pool created before the
dialog, and have a different view of the memory than the gui threadq
?). Is it up to the plugin author to properly synchronize stuff ? How
is this best done ?

Multithreaded programming always gives me a headache, and as there is
no mention of thread-safety in the docs I figured I'd ask.

Is the situation clearer with ImageJ2 ?

cheers,
Adrian

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html