• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How similar is C++ concurrency API to Java

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Cristina Yenyxe
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So learning how to use it should not be too complicated Thank you!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic