{"width":"100%","categories":["Go","Exported from Qiita"],"provider_url":"https://hatena.blog","author_url":"https://blog.hatena.ne.jp/lufiabb/","height":"190","author_name":"lufiabb","url":"https://blog.lufia.org/entry/2016/04/12/015200","image_url":null,"blog_url":"https://blog.lufia.org/","type":"rich","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.lufia.org%2Fentry%2F2016%2F04%2F12%2F015200\" title=\"atomic\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u5fc5\u8981\u306a\u7406\u7531\u3068\u4f7f\u3044\u65b9 - Plan 9\u3068Go\u8a00\u8a9e\u306e\u30d6\u30ed\u30b0\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","provider_name":"Hatena Blog","blog_title":"Plan 9\u3068Go\u8a00\u8a9e\u306e\u30d6\u30ed\u30b0","description":"\u3053\u306e\u8a18\u4e8b\u306fQiita\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3057\u305f \u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\u901a\u5e38\u5206\u304b\u308a\u3065\u3089\u3044\u30d0\u30b0\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002 package main import ( \"fmt\" \"runtime\" \"sync\" ) type Counter int32 func (c *Counter) Inc() { *c++ } func main() { var c Counter var wg sync.WaitGroup for i := 0; i < 1000; i++ { wg.Add(1) go func() { c.Inc() wg.Done() }() } wg.Wait() fmt.Println(\"Count =\u2026","title":"atomic\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u5fc5\u8981\u306a\u7406\u7531\u3068\u4f7f\u3044\u65b9","published":"2016-04-12 01:52:00","version":"1.0"}