[vtkusers] using MultiThreader , more info
reyes mauricio
mreyesa at hotmail.com
Tue Feb 10 03:20:23 EST 2004
Hi vtkUsers!,
I found out that if I set more threads (example: 10) I get the following
output:
1
2
3
4
5
6
7
8
9
0
And not the value that I pass as userdata. Strange no?.Well, I'd like to use
vtkThreads to process a vtkImageData object, I tested passing an object of
this type to the thread function and printing the Dimensions of it, getting
: 1 1 1 . I don't know what I'm doing wrong.
Any insight would be very appreciated, thanks in advance .
Mauricio
Mauricio Reyes wrote:
Hi vtkUsers,
I try to use vtkMultiThreader in a simple example like printing the data
passed to the thread, this is my code:
//some test value
int a=23;
int *pa;
pa=&a;
vtkMultiThreader *threader=vtkMultiThreader::New();
threader->SetNumberOfThreads(1);
threader->SetSingleMethod(myfunction,(int*)pa);
threader->SingleMethodExecute();
...
..
where "myfunction" is:
VTK_THREAD_RETURN_TYPE myfunction(void *arg)
{
cout<<*((int*)arg)<<std::endl;
return VTK_THREAD_RETURN_VALUE;
}
After executing this code, I get a zero value from the Thread, what could be
happening?
The compilation and linking are ok, so I presume that I don't have to add
any extra configuration to cmake, or am I wrong?
Best Regards,
Mauricio
______________________________________________
_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger:
http://messenger.latam.msn.com/
More information about the vtkusers
mailing list