[ImageJ-devel] Local Neighborhood stuff

Stephan Saalfeld saalfeld at mpi-cbg.de
Mon Aug 20 07:54:16 CDT 2012


No---that would work in all cases.  It would fail if you put the inner
loop into threads.

for ( Neighborhood<T> n : chunks) {
  for (int i =0; i < nThreads, i++) {
    threads[i] = new Thread() {  
       public void run() {              
         for ( T t : n )
           ... 
...
...

When would you do that?  E.g. when applying a multi-threaded
implementation to a neighborhood.




On Mon, 2012-08-20 at 14:50 +0200, Jean-Yves Tinevez wrote:
> Hi Stephan
> 
> Just to be sure I got your point:
> 
> You mean that if we iterate over all the neighbohoods of a single
> final image in a multithreaded way, we might screw up with the unsafe
> implementations right? In a pseudo code, this:
> 
> for (int i =0; i < nThreads, i++) {
>   threads[i] = new Thread() {
>   
>     public void run() {
> 
>              for ( Neighborhood<T> n : chunks)
>                     for ( T t : n )
>           ... 
> ...
> ...
> 
> would always fail with the unsafe implementation and always work with
> safe implementations? Right??




More information about the ImageJ-devel mailing list