| Author |
Special features in new C++0x
|
Vijitha Kumara
Bartender
Joined: Mar 24, 2008
Posts: 3670
|
|
Hi Anthony,
Any special features in the new facilities you'd like to highlight or any simplifications provided for concurrency in C++ ?
|
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
|
 |
Anthony Aj Williams
author
Ranch Hand
Joined: Jun 10, 2011
Posts: 56
|
|
Vijitha Kumara wrote:Any special features in the new facilities you'd like to highlight or any simplifications provided for concurrency in C++ ?
There are lots of great language features that have been added to C++0x. The two that I think will have the most direct impact on code I write will be the new use of auto for type deduction of variables, the introduction of lambda functions.
These facilities work really well with the new C++0x thread library --- you can pass a lambda to the std::thread constructor, or to std::async to start a thread, and you can use auto to capture the future from std::async without having to type out the type of the returned future:
As far as concurrency facilities go, std::async is my favourite, but I wouldn't like to give up the RAII lock classes std::lock_guard<> and std::unique_lock<> when dealing with mutexes --- it's just so much easier using them than explicitly locking and unlocking mutexes.
|
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
|
 |
Vijitha Kumara
Bartender
Joined: Mar 24, 2008
Posts: 3670
|
|
|
Thanks for the information...
|
 |
 |
|
|
subject: Special features in new C++0x
|
|
|