[Insight-users] ITK Threads with memberfunctions
Miller, James V (GE, Research)
millerjv at crd.ge.com
Wed Jun 7 16:41:12 EDT 2006
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/20060607/7fffc579/attachment.htm
More information about the Insight-users
mailing list