- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's the same what Dmitry wrote: if thread T1 pushes Ai, then transfers ownership to thread T2, and then T2 pushes Bj, a consumer will take Ai first, then Bj, for any i and j. If you have multiple consumer threads, the above holds true for any of these threads (i.e. no thread can dequeue Bj and then Ai).
However there is no global ordering guarantees,e.g. A_last and B_first can be dequeued concurrently by different threads, and whichever finishes first is unknown.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's the same what Dmitry wrote: if thread T1 pushes Ai, then transfers ownership to thread T2, and then T2 pushes Bj, a consumer will take Ai first, then Bj, for any i and j. If you have multiple consumer threads, the above holds true for any of these threads (i.e. no thread can dequeue Bj and then Ai).
However there is no global ordering guarantees,e.g. A_last and B_first can be dequeued concurrently by different threads, and whichever finishes first is unknown.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, with respect to concurrent push:
There is a point within the enqueue code (push code), that could be called (considered as) an "atomic line of demarcation". The implementation of which can be determined by looking at the code, but could be as simple as an atomic increment of a variable, or as heavy as a critical section. The order in which the threads pass through this atomic line of demarcation, and which asserts the FIFO order, is not necessarily the order in which the threads began the push statement. IOW there is some code to pass through to get up to the "atomic line of demarcation".
Additionally, and this again is dependent on implementation, it may be possible for the 2nd thread in concurrent push situation, to exit the FIFO push prior to the 1st thread exiting the FIFO push.
When you need to control the moment in time for this ordering, then youmay have to roll your own code or modify the TBB code to suit your requirements.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page