When a TBB task executes a potentially blocking I/O operation (for example, reading a file), will the TBB schedule do something smart to avoid wasting CPU time?
So basically (in the case of file or network I/O) I create my own thread, and use (something like) a tbb::concurrent_bounded_queue to move data between it and the producer or consumer task?
Or is your point to use the task::enqueue method as a way of kicking off asynchronous work?
Also, if you do mean I should create my own native thread, does TBB expose a platform-neutral thread library?
TBB 3.0 exposes std::thread. It's defined in include/tbb/compat/thread and fairly close to the C++1x draft std::thread. The significant differences are where time units are requred. Our version uses tbb::tick_count::interval_t because we did not want to recreate the C++1x std::chrono facilities. (We had to stop somewhere, or transitive closure would force us to write a full C++1x library :-)