<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=660033820-07062006><FONT face=Arial color=#0000ff
size=2>Marcus,</FONT></SPAN></DIV>
<DIV><SPAN class=660033820-07062006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=660033820-07062006><FONT face=Arial color=#0000ff size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=660033820-07062006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=660033820-07062006><FONT face=Arial color=#0000ff size=2>This
is how the multithreaded filters are implemented. Take a look at
ImageSource::GenerateData() and
ImageSource::ThreaderCallback().</FONT></SPAN></DIV>
<DIV><SPAN class=660033820-07062006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=660033820-07062006><FONT face=Arial color=#0000ff
size=2>Jim</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
insight-users-bounces+millerjv=crd.ge.com@itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com@itk.org]<B>On Behalf Of
</B>Markus Weigert<BR><B>Sent:</B> Wednesday, June 07, 2006 2:38
PM<BR><B>To:</B> insight-users@itk.org<BR><B>Subject:</B> [Insight-users] ITK
Threads with memberfunctions<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Dear all,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I would like to make a programm, at which I'm
currenty </FONT></DIV>
<DIV><FONT face=Arial size=2>working, multithreaded.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>As far as I know, there is a class called
itkMultiThreader which</FONT></DIV>
<DIV><FONT face=Arial size=2>provides this functionality.</FONT></DIV>
<DIV><FONT face=Arial size=2>My question is, if this class can also be used
to create a thread</FONT></DIV>
<DIV><FONT face=Arial size=2>for a memberfunction of an object, because I
always receive compiler</FONT></DIV>
<DIV><FONT face=Arial size=2>complaints from VC6 on std_call problems
when I call SetSingleMethod().</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>As far as I know, </FONT><FONT face=Arial
size=2>for example posix threads only work with C-functions.</FONT></DIV>
<DIV><FONT face=Arial size=2>So, is this also true for the multithreader or
may the problem be different?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I think that for example, the threads from Boost
library can deal with member functions,</FONT></DIV>
<DIV><FONT face=Arial size=2>but I would not like to use a large library only
for one small feature.</FONT></DIV>
<DIV><FONT face=Arial size=2>Can you please give me a hint?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Markus</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>PS: declaring the function as static is not
possible, </FONT></DIV>
<DIV><FONT face=Arial size=2>because it accesses non-static
members.</FONT></DIV></BLOCKQUOTE></BODY></HTML>