OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Lifetime of parameters to asynchronous calls

From: Tim Day (Tim.DayVOXAR.COM)
Date: Fri Feb 27 2004 - 10:05:52 CST


Consider an interface (Foo, say) which has a method (Bar, say)
with an [in] parameter which is a pointer to an array of bytes.

For the async version there will be a
AsyncIFoo::Begin_Bar(/*[in]*/ byte* stuff)

Assuming the implementation fires up a worker thread to do it's work
(I'm following the pattern in
MicrosoftSDK\Samples\Com\Fundamentals\AsyncCalls\FullSvr
), can I safely just retain a copy of the stuff pointer in a
CAsyncFoo::m_stuff i.e m_stuff=stuff; and have my worker thread
access it without worrying about it being freed up before
the end of the corresponding CAsyncFoo::Finish_Bar() ?
Or could DCOM blow it away any time after Begin_Bar returns
(and I should take an owned copy) ?

Thanks for any help
Tim

----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.html
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-requestDISCUSS.MICROSOFT.COM