View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004285VTK(No Category)public2007-01-08 04:112012-03-07 03:16
Reporterxabi riobe 
Assigned ToLisa Avila 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0004285: thread event leads to deadlock
DescriptionThe problem comes from the following macro in vtkFixedPointVolumeRayCastHelper.h :

//BTX
#define VTKKWRCHelper_IncrementAndLoopEnd() \
      imagePtr+=4; \
      } \
    if( 0==threadID && ( j%10 || j==imageInUseSize[1]-1 ) ) /*if ( j%32 == 31 )*/ \
      { \
      double fargs[1]; \
      fargs[0] = static_cast<double>(j)/static_cast<float>(imageInUseSize[1]-1); \
      mapper->InvokeEvent( vtkCommand::VolumeMapperRenderProgressEvent, fargs ); \
      } \
    }
//ETX


I have a vtkCommand observing the event that calls a method
SetProgressState(value) of an object containing a wxProgressDialog
that will be updated with the value comming from 'fargs'.

The problem is that wxProgressDialog calls a "SendMessage" (windows)
and if the event has been fired in a thread that is not the main one,
all that leads to a deadlock when trying to draw the progress bar.

For example if we have two threads for the raycast, the main one will
be in charge of the pair values for the j variable and the event will
be fired by the other thread (when j%32 == 31, j is not pair)

So a solution to avoid that is replacing the "if" line in the #define
by this one:

if( 0==threadID && ( j%10 || j==imageInUseSize[1]-1 ) )

In that case the event is only fired by the main thread.
( j%10 is to have a more precise progression and
j==imageInUseSize[1]-1 is to have the value 1.0 with the ProgressEvent
and not only for the EndProgressEvent ).
TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0006105)
xabi riobe (reporter)
2007-01-08 04:19

oops, the macro posted is after the patch, the original one is with the code commented:
 if ( j%32 == 31 )
(0007041)
xabi riobe (reporter)
2007-04-02 10:12

sorry, the j%10 must be replaced by (j%10 == 0) of course (or another value instead of 10, just an example).

 Issue History
Date Modified Username Field Change
2011-06-16 13:11 Zack Galbreath Category => (No Category)
2012-03-07 03:16 xabi riobe Status expired => closed
2012-03-07 03:16 xabi riobe Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team