[Insight-users] ITK Threads with memberfunctions
Markus Weigert
m.weigert at fz-juelich.de
Thu Jun 8 06:16:03 EDT 2006
Hi again,
I've done the threading now like it is done in the ImageSource class.
But what I observe when I try to execute it, is not what should happen.
I expected to see two different processes in the Task Manager (Win XP),
when I call SingleMethodExecute().
But this is not the case. I actually see two tasks of the programm, but only
a single process. I expected to have two processes, which run in parallel,
one doing registration (the one which is newly created) and the original one,
which is doing GUI staff (FLTK).
I'm doing this to be able to stop the registration process manually by observing the
optimizer.
Regards,
Markus
----- Original Message -----
From: Miller, James V (GE, Research)
To: Markus Weigert ; insight-users at itk.org
Sent: Wednesday, June 07, 2006 10:41 PM
Subject: RE: [Insight-users] ITK Threads with memberfunctions
Marcus,
The pattern I use to have the multithreader call a static function (or a standard C function) and pass the object as part of the clientdata. The static method, then casts the clientdata back to the object type and calls the member function that I wanted to call.
This is how the multithreaded filters are implemented. Take a look at ImageSource::GenerateData() and ImageSource::ThreaderCallback().
Jim
-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org [mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of Markus Weigert
Sent: Wednesday, June 07, 2006 2:38 PM
To: insight-users at itk.org
Subject: [Insight-users] ITK Threads with memberfunctions
Dear all,
I would like to make a programm, at which I'm currenty
working, multithreaded.
As far as I know, there is a class called itkMultiThreader which
provides this functionality.
My question is, if this class can also be used to create a thread
for a memberfunction of an object, because I always receive compiler
complaints from VC6 on std_call problems when I call SetSingleMethod().
As far as I know, for example posix threads only work with C-functions.
So, is this also true for the multithreader or may the problem be different?
I think that for example, the threads from Boost library can deal with member functions,
but I would not like to use a large library only for one small feature.
Can you please give me a hint?
Regards,
Markus
PS: declaring the function as static is not possible,
because it accesses non-static members.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060608/dc7fe731/attachment-0001.htm
More information about the Insight-users
mailing list