commit | b1c9cc2f2d1b0478b07278cdef885cabf1cd2798 | [log] [tgz] |
---|---|---|
author | Andy McFadden <fadden@android.com> | Thu Sep 23 12:30:12 2010 -0700 |
committer | Andy McFadden <fadden@android.com> | Thu Sep 23 12:30:12 2010 -0700 |
tree | 25c4183bf8bf069e392797ed55d90ff1f4badc50 | |
parent | 8939c1e1cca71151a841f5c1d47ed7004cc14d80 [diff] |
Add memory barriers to pthread_once. The implementation was using a double-checked locking approach that could break on SMP. In addition to the barriers I also switched to a volatile pointer. I don't think this will matter unless gcc can conclude that _normal_lock can't affect *once_control, but I figured it was better to be safe. (It seems to have no impact whatsoever on the generated code.) Bug 3022795. Change-Id: Ib91da25d57ff5bee4288526e39d457153ef6aacd