- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
feeder.add() in theReference document said "Must be called from a call to body.operator() created by parallel_do. Otherwise,the termination semantics of method operator() are undefined.Must be called from a call to body.operator() created by parallel_do. Otherwise,the termination semantics of method operator() are undefined.".
Does it means if we call feeder.add() outside the body.operator() will cause race condtions and we may lose items if race condtions indeed happen? But if we call it inside the body.operator(), such things will not happen because TBB will guarantees feeder.add() is mutual exclusive?
Thank you.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My initial impression is that the documentation leaves room for further optimisation by imposing more restrictions on the programmer than currently required (isn't/shouldn't there be more than one feeder?), but even with this reduced responsibility you would already have to know that parallel_do() is not yet winding down (including removal of that feeder, whose longevity is not guaranteed beyond an operator() call), and, even if you can guarantee that, such code may still break with a future version of TBB.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page