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

Delta Between Two Patch Sets: src/pkg/sync/atomic/doc.go

Issue 4241041: code review 4241041: sync/atomic: new package (Closed)
Left Patch Set: Created 14 years ago
Right Patch Set: diff -r b5fbdfb23f4f https://go.googlecode.com/hg Created 14 years 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:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/sync/atomic/atomic_test.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Package atomic provides low-level atomic memory primitives
6 // useful for implementing synchronization algorithms.
7 //
8 // These functions require great care to be used correctly.
9 // Except for special, low-level applications, synchronization is better
10 // done with channels or the facilities of the sync package.
11 // Share memory by communicating;
12 // don't communicate by sharing memory.
13 //
14 // The compare-and-swap operation, implemented by the CompareAndSwapT
15 // functions, is the atomic equivalent of:
16 //
17 // if *val == old {
18 // *val = new
19 // return true
20 // }
21 // return false
22 //
23 package atomic
24
25 // BUG(rsc):
26 // On ARM, the 64-bit functions use instructions unavailable before ARM 11.
27 //
28 // On x86-32, the 64-bit functions use instructions unavailable before the Penti um.
29
30 // CompareAndSwapInt32 executes the compare-and-swap operation for an int32 valu e.
31 func CompareAndSwapInt32(val *int32, old, new int32) (swapped bool)
32
33 // CompareAndSwapInt64 executes the compare-and-swap operation for an int64 valu e.
34 func CompareAndSwapInt64(val *int64, old, new int64) (swapped bool)
35
36 // CompareAndSwapUint32 executes the compare-and-swap operation for a uint32 val ue.
37 func CompareAndSwapUint32(val *uint32, old, new uint32) (swapped bool)
38
39 // CompareAndSwapUint64 executes the compare-and-swap operation for a uint64 val ue.
40 func CompareAndSwapUint64(val *uint64, old, new uint64) (swapped bool)
41
42 // CompareAndSwapUintptr executes the compare-and-swap operation for a uintptr v alue.
43 func CompareAndSwapUintptr(val *uintptr, old, new uintptr) (swapped bool)
44
45 // AddInt32 atomically adds delta to *val and returns the new value.
46 func AddInt32(val *int32, delta int32) (new int32)
47
48 // AddUint32 atomically adds delta to *val and returns the new value.
49 func AddUint32(val *uint32, delta uint32) (new uint32)
50
51 // AddInt64 atomically adds delta to *val and returns the new value.
52 func AddInt64(val *int64, delta int64) (new int64)
53
54 // AddUint64 atomically adds delta to *val and returns the new value.
55 func AddUint64(val *uint64, delta uint64) (new uint64)
56
57 // AddUintptr atomically adds delta to *val and returns the new value.
58 func AddUintptr(val *uintptr, delta uintptr) (new uintptr)
LEFTRIGHT

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