aspose file tools*
The moose likes C / C++ and the fly likes How similar is C++ concurrency API to Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "How similar is C++ concurrency API to Java" Watch "How similar is C++ concurrency API to Java" New topic
Author

How similar is C++ concurrency API to Java

Cristina Yenyxe
Greenhorn

Joined: May 04, 2010
Posts: 6
Hello!

My question is basically the subject. I've used the Threading API in Java in several projects and then another one for C++ was announced, and it looked really similar (also the ones in other languages). What are the most important differences between them? Do you make any parallelism in your book? Not that I consider it the most important thing, but it could make the API easier to understand for people in my situation.

Greetings and thanks in advance,
Cristina
Anthony Aj Williams
author
Ranch Hand

Joined: Jun 10, 2011
Posts: 56
Cristina Yenyxe wrote:My question is basically the subject. I've used the Threading API in Java in several projects and then another one for C++ was announced, and it looked really similar (also the ones in other languages). What are the most important differences between them? Do you make any parallelism in your book? Not that I consider it the most important thing, but it could make the API easier to understand for people in my situation.


One of the appendices has a comparison table which relates the C++0x concurrency facilities to others, including the Java Threading API. To a large extent the differences are just syntactic rather than semantic.

The most obvious differences are that a new thread is started immediately when you pass the thread function to the std::thread constructor, rather than waiting for you to call Start(), and that you can pass any callable object or function to the std::thread constructor rather than having to derive a new class from Runnable.

One other noticable difference is that in Java you can use synchronized on any object; in C++0x you must explicitly provide a mutex object for locking.


Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/
just::thread C++11 thread library http://www.stdthread.co.uk
Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
Cristina Yenyxe
Greenhorn

Joined: May 04, 2010
Posts: 6
So learning how to use it should not be too complicated Thank you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How similar is C++ concurrency API to Java
 
Similar Threads
XML Certification
New Java licensing, very important for all java programmers. ( similar to GPL )
Google search is useless
Why and How Java is better than C#?
Java web application communication and call back with C/C++ programming language API