TimeGT launching soon!

 

Lazy-init variables are not always safe

Have you ever used following to lazy-initialize your variable?

codeshot.png
If you have then don’t.

Just to remind or introduce, it looks OK but it isn’t - this is a pretty serious bug you can easily make.

And it’s called Double-Checked Locking.
Very good and easy-to-understand explanation is here

Share:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Reddit
Tuesday, May 16, 8:12 am

No Comments »

No comments yet.

RSS feed for comments on this post. | TrackBack URI
You can also bookmark this on del.icio.us or check the cosmos

Leave a comment

XHTML ( You can use these tags): <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong> .