An example of a more advanced associative operation is to find the index where Foo(i) is minimized. A serial version might look like this:
Sometimes a thread must wait for an element v[i] that is being asynchronously added by another thread. The following idiom can be used for the wait:
Wait until i<v.size(). Afterwards, v[i] is known to be allocated, but perhaps not constructed.
Wait for v[i] to be constructed.
On Windows* and Linux* operating systems, it is possible to automatically replace all calls to standard functions for dynamic memory allocation (such as malloc) with the Intel® Threading Building Blocks (Intel® TBB) scalable equivalents. Doing so can sometimes improve application performance.
- Page 1