Yep, the CSDK is unfortunately not thread safe, so these calls need to be 
serialized.

From: ak.ashwini1981 [mailto:[email protected]]
Sent: Friday, August 07, 2015 12:47 AM
To: Keane, Erich
Cc: iotivity-dev at lists.iotivity.org
Subject: Re: Pass by reference thru IClientWrapper/ checked_guard()


Lookig at the InProcClientWrapper implementation. it seems that it is 
serializig all the calls to C APIs thru the locking mechanism. i.e. only one 
API at a time can be called.

Any specific reason behind it?

BR,
Ashwini
On "Keane, Erich" <erich.keane at intel.com>, 3 Aug 2015 23:47 wrote:

I've created a simple reproduction on my box.  It seems that
checked_guard isn't causing the problem directly.  It calls nil_guard,
which uses std::bind.

I'm going to see if I can replace the std::bind call with one that
captures appropriately.

-Erich

On Mon, 2015-08-03 at 22:36 +0530, ak.ashwini1981 wrote:
> out parameter are due to the underlying C-API.
>
> the checked-guard mainly checks tge nullptr params... which i am
> taking care of otherwise..
>
> checked-guard takes in rvalue reference.. and forwards that.  this
> created the doubt.
>
> i will share the code snippet here..
>
> thanks.
> Ashwini
>
> On "Keane, Erich" <erich.keane at intel.com<mailto:erich.keane at 
> intel.com>>, 3 Aug 2015 22:02 wrote:
>         We'd prefer to keep the checked-guard, since its purpose is to
>         ensure
>         that all errors are consistently thrown throughout the
>         process.
>
>         We tend to avoid out-parameters so far in the C++ stack due to
>         the
>         inherent concerns with it, but if it is the only way to do it,
>         I'd wish
>         to see as soon as possible to make sure it is necessary.
>
>         As far as std::forward, my understanding is that it should
>         maintain the
>         reference-ness of the parameters, so we could potentially have
>         an issue.
>
>         Got a sample that you could share?  If I get time I could take
>         a look.
>
>         -Erich
>
>
>         On Mon, 2015-08-03 at 21:58 +0530, ak.ashwini1981 wrote:
>         >
>         >
>         > Hi Erich, List,
>         >
>         >
>         >
>         > I am working on the  Provisioning Manager apis from C++
>         space.
>         >
>         >
>         >
>         > Intention is to have an out parameter in the function. The
>         parameter
>         > is a vector. I am passing this by reference. Pushing objects
>         to vector
>         > are not reflecting at the calling point.
>         >
>         >
>         >
>         > On debugging  found that the reference pointers are
>         different at two
>         > sides of the checked_guard() function.
>         >
>         > Guess the std::forward is doing the trick here.
>         >
>         >
>         >
>         > Can I do without the checked_guard() and do the required
>         param
>         > validation and call the InProcClientWrapper function.
>         >
>         >
>         >
>         > Share your inputs.
>         >
>         >
>         >
>         > Thanks,
>         >
>         > Ashwini
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20150807/6e511185/attachment.html>

Reply via email to