IssueRaiser

There's more that needs to be done if the goal is "look at these interesting threading issues that arise and how we address them in (non ...

There's more that needs to be done if the goal is "look at these interesting threading issues that arise and how we address them in (non idiomatic) Go", because the initialization described in the post is broken. Shared-memory multithreading is hard. Golang does not do much to prevent you from shooting yourself in the foot here, as this post proves. So use the abstractions wherever possible. In this case, Once correctly performs the atomics, and naive double-checked locking doesn't.

Posted by pcwalton on Jul 12, 2015, 5:29 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.5,500 issues0 comments

reliability (Other)

There's more that needs to be done if the goal is "look at these interesting threading issues that arise and how we address them in (non ...

pcwaltonJul 12, 2015, 5:29 PM

There's more that needs to be done if the goal is "look at these interesting threading issues that arise and how we address them in (non idiomatic) Go", because the initialization described in the post is broken. Shared-memory multithreading is hard. Golang does not do much to prevent you from shooting yourself in the foot here, as this post proves. So use the abstractions wherever possible. In this case, Once correctly performs the atomics, and naive double-checked locking doesn't.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue