[Nfd-dev] thread safety of ndn::face::expressInterest()

Alex Afanasyev alexander.afanasyev at ucla.edu
Wed Jan 21 12:48:54 PST 2015


> On Jan 21, 2015, at 12:37 PM, Davide Pesavento <davide.pesavento at lip6.fr> wrote:
> 
> But doesn't this mean that all calls depending on io_service (e.g.
> network operations) are effectively single-threaded?

Yes. As of right now it means exactly this.  This was in attempt to avoid additional locking inside ndn-cxx implementation (which I believe would have resulted in about the same effect).  The cpu-heavy signature creation and verification (just verification part) can be performed in separate threads, as they are independent of io_service.

---
Alex

> Best,
> Davide
> 
> On Wed, Jan 21, 2015 at 9:17 PM, Alex Afanasyev
> <alexander.afanasyev at ucla.edu> wrote:
>> Hi Shuo,
>> 
>> There shouldn’t be problem expressing interests (or do any other job) with ndn-cxx within multiple threads.  However, there is a strong requirement that Face::processEvents (or io_service::run) is called exactly once in some thread (doesn’t really matter which one).
>> 
>> The library will ensure that interests expressed from different threads are properly synchronized/serialized.
>> 
>>>> Alex
>> 
>>> On Jan 21, 2015, at 7:05 AM, Shuo Chen <chenatu2006 at gmail.com> wrote:
>>> 
>>> Hi everyone,
>>> 
>>> I was trying to express interests in multi threads. Is ndn::face::expressInterest() thread-safe? Besides, which components of ndn-cxx are thread-safe and which are not?
>>> 
>>> ----
>>> Shuo Chen
>>> Tsinghua University
>> 
>> 
>> _______________________________________________
>> Nfd-dev mailing list
>> Nfd-dev at lists.cs.ucla.edu
>> http://www.lists.cs.ucla.edu/mailman/listinfo/nfd-dev
>> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/attachments/20150121/bc04ed51/attachment.bin>


More information about the Nfd-dev mailing list