Perhaps you could clarify what exactly you are looking for
Intel® Threading Building Blocks (Intel TBB) offers a rich and comprehensive approach to expressing parallelism in a C ++ program. This is a library that helps you take advantage of multi-core processors without being a thread expert. Intel TBB is not just a thread replacement library. It is a high-level, task-based parallelism that abstracts platform details and flow mechanisms for scalability and performance.
This is what concurrency libraries have done since 1998 and became part of Java 5.0 in 2004.
EDIT: Suppose you need a thread pool that can use all logical processors on your system.
ExecutorService es = Executors.newFixedThreadPool( Runtime.getRuntime().availableProcessors); // to add a number of tasks for(int i=0; i<numberOfTasks; i++) { es.submit(new Callable<ResultType>() { public ResultType call() { return doWork(i); } } }
This will do doWork for each free stream.
Looking at their features, they look very familiar.
I looked at some of the low-level optimizations, such as thread-supported memory allocation. In Java, this is called TLAB (Streaming Local Distribution Buffers) and transparent. I suspect that most Java developers do not even know that they exist.
Results and exceptions are captured for you in the Future object, which you can check later.
You may have "condition variables" such as CountdownLatch or CyclicBarrier
A new container imitating C ++ 0x unordered_map and based on a joint specification implemented by Intel (TBB 3.0) and Microsoft (Visual Studio 2010). It has three advantages over the previous concurrent_hash_map parameter:
- Interface very similar to C ++ 0x unordered_map
- It allows for simultaneous insertion and crawl.
- No lock is opened by the interface. An implementation may use locks internally, but a lock is never displayed in a way that can contribute to a deadlock. It may contain locks inside, but never call custom code.
Java ConcurrentHashMap supports the ConcurrentMap and Map interfaces, allows simultaneous insertion and bypass, and does not provide any locks;) It's at least 9 years old, so you know that it must be reliable and stable.
There is a PriorityQueue that you can use in your thread pool if you want.