Re: Prepare,Attach and DetachThread for delivering indications

Venkateswara R Puvvada <[email protected]>
Newsgroups gmane.network.open-pegasus.general
Message-ID <OF624F39D9.B2DD714D-ON65257797.0016299C-65257797.001881E5@in.ibm.com>
<[email protected]> 
06/09/2010 19:25

To
<[email protected]>
cc
<[email protected]>
Subject
Prepare,Attach and DetachThread for delivering indications






Hi,
   We are developing a indication provider. The problem is, every time 
indication is generated, there seems to be an memory leak ( caught through 
pmap). We have gone through Pegasus documentation and still not clear 
about following usage:-
 
>1. Should Provider explicitly do CMRelease the CMPI instance which is 
created through CMNewInstance for passing in CBDeliverIndication >or 
CBDeliverIndication  internally frees it?
 
CBDeliverIndication() does not free the indication instance. Free the 
instance using the CMRelease() explicitly.

>2. Can AttachThread be called once in the beginning and detachThread at 
the termination point when there may be multiple deliver >indications in 
between ?
 
Yes. Note that any CMPI encapsulated objects created after calling the CB
AttachThread() are only freed after CBDettachThread() is called unless 
objects are explicitly released using the CMRelease().

3. In sample indication provider 
(/src/Providers/TestProviders/CMPI/TestIndications), we have found a new 
thread is created using  _broker->xft->newThread to attachThread and 
deliver indication. But we are calling PrepareAttachThread in 
ActivateFilter() and calling CBAttachThread and DeliverIndication in a 
native thread context . Is there any harm ? 

CBPrepareAttachThread() just clones the CMPI Context. I am not sure about 
the "native thread context" you are referring to. You may generate the 
indications in the activateFilter() method if the enableIndications() 
method of the provider was already called. But usually when 
enableIndications() method is called  provider spawns a new thread (using 
_broker->xft->newThread), attaches to the CMPI run time system using the 
CBAttachThread() and start generating the indications.
 
>4. Can PrepareAttachThread be called from a non-cimom generated thread?
 >
No. This is not portable. It is recommended that threading related 
operations are performed using the OS abstraction functions provided by 
CMPI (CMPIBrokerExt)

Thanks
Souvik
 
 
Please do not print this email unless it is absolutely necessary. 
The information contained in this electronic message and any attachments 
to this message are intended for the exclusive use of the addressee(s) and 
may contain proprietary, confidential or privileged information. If you 
are not the intended recipient, you should not disseminate, distribute or 
copy this e-mail. Please notify the sender immediately and destroy all 
copies of this message and any attachments. 
WARNING: Computer viruses can be transmitted via email. The recipient 
should check this email and any attachments for the presence of viruses. 
The company accepts no liability for any damage caused by any virus 
transmitted by this email. 
www.wipro.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.