Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(408)

Side by Side Diff: src/pkg/sync/atomic/doc.go

Issue 7001056: code review 7001056: sync/atomic: document that users must deal with 64-bit ... (Closed)
Patch Set: diff -r 5f9e99e3f2ea https://code.google.com/p/go/ Created 11 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build !race 5 // +build !race
6 6
7 // Package atomic provides low-level atomic memory primitives 7 // Package atomic provides low-level atomic memory primitives
8 // useful for implementing synchronization algorithms. 8 // useful for implementing synchronization algorithms.
9 // 9 //
10 // These functions require great care to be used correctly. 10 // These functions require great care to be used correctly.
(...skipping 20 matching lines...) Expand all
31 // The load and store operations, implemented by the LoadT and StoreT 31 // The load and store operations, implemented by the LoadT and StoreT
32 // functions, are the atomic equivalents of "return *addr" and 32 // functions, are the atomic equivalents of "return *addr" and
33 // "*addr = val". 33 // "*addr = val".
34 // 34 //
35 package atomic 35 package atomic
36 36
37 import ( 37 import (
38 "unsafe" 38 "unsafe"
39 ) 39 )
40 40
41 // BUG(rsc): On ARM, the 64-bit functions use instructions unavailable before AR M 11. 41 // BUG(rsc): On ARM, the 64-bit functions use instructions unavailable before AR M 11.
minux1 2012/12/23 13:14:18 while you're at it, please remove this BUG, as it'
42 // 42 //
43 // On x86-32, the 64-bit functions use instructions unavailable before the Penti um MMX. 43 // On x86-32, the 64-bit functions use instructions unavailable before the Penti um MMX.
44 //
45 // On both ARM and x86-32, it is the caller's responsibility to arrange for 64-b it
46 // alignment of 64-bit words accessed atomically. The first word in an allocated
47 // struct or slice can be relied upon to be 64-bit aligned.
44 48
45 // CompareAndSwapInt32 executes the compare-and-swap operation for an int32 valu e. 49 // CompareAndSwapInt32 executes the compare-and-swap operation for an int32 valu e.
46 func CompareAndSwapInt32(addr *int32, old, new int32) (swapped bool) 50 func CompareAndSwapInt32(addr *int32, old, new int32) (swapped bool)
47 51
48 // CompareAndSwapInt64 executes the compare-and-swap operation for an int64 valu e. 52 // CompareAndSwapInt64 executes the compare-and-swap operation for an int64 valu e.
49 func CompareAndSwapInt64(addr *int64, old, new int64) (swapped bool) 53 func CompareAndSwapInt64(addr *int64, old, new int64) (swapped bool)
50 54
51 // CompareAndSwapUint32 executes the compare-and-swap operation for a uint32 val ue. 55 // CompareAndSwapUint32 executes the compare-and-swap operation for a uint32 val ue.
52 func CompareAndSwapUint32(addr *uint32, old, new uint32) (swapped bool) 56 func CompareAndSwapUint32(addr *uint32, old, new uint32) (swapped bool)
53 57
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // StoreUintptr atomically stores val into *addr. 112 // StoreUintptr atomically stores val into *addr.
109 func StoreUintptr(addr *uintptr, val uintptr) 113 func StoreUintptr(addr *uintptr, val uintptr)
110 114
111 // StorePointer atomically stores val into *addr. 115 // StorePointer atomically stores val into *addr.
112 func StorePointer(addr *unsafe.Pointer, val unsafe.Pointer) 116 func StorePointer(addr *unsafe.Pointer, val unsafe.Pointer)
113 117
114 // Helper for ARM. Linker will discard on other systems 118 // Helper for ARM. Linker will discard on other systems
115 func panic64() { 119 func panic64() {
116 panic("sync/atomic: broken 64-bit atomic operations (buggy QEMU)") 120 panic("sync/atomic: broken 64-bit atomic operations (buggy QEMU)")
117 } 121 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b