wood burning stoves 2.0*
The moose likes C / C++ and the fly likes Do you cover Double Checked Locked Singletons? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Do you cover Double Checked Locked Singletons?" Watch "Do you cover Double Checked Locked Singletons?" New topic
Author

Do you cover Double Checked Locked Singletons?

Anand Hariharan
Rancher

Joined: Aug 22, 2006
Posts: 257

Congratulations on your book, Antony.

Took a look at the book's contents and the free introduction chapter. Seems like you would cover atomic<T> and similar new constructs introduced in the language.

Would like to know if you cover perils of using singletons (whether in general or in a multi-threaded environment), and include any coverage regarding the oft-lambasted 'double checked locking' pattern.

thank you for your attention,
- Anand

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exupery
Anthony Aj Williams
author
Ranch Hand

Joined: Jun 10, 2011
Posts: 56
Anand Hariharan wrote:Would like to know if you cover perils of using singletons (whether in general or in a multi-threaded environment), and include any coverage regarding the oft-lambasted 'double checked locking' pattern.


Double-checked locking is covered in chapter 3, where I recommend using std::call_once instead.


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
Anand Hariharan
Rancher

Joined: Aug 22, 2006
Posts: 257

Thank you, Anthony.

sincerely,
- Anand
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Do you cover Double Checked Locked Singletons?
 
Similar Threads
So is double-checked locking really working in j2se 1.5?
Problem with Program on Dual processor
java memory model
Static vs Single Pattern
Singleton and Thread Safety