OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [sync/] [atomic/] [doc.go] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// 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
import (
26
        "unsafe"
27
)
28
 
29
// BUG(rsc): On ARM, the 64-bit functions use instructions unavailable before ARM 11.
30
//
31
// On x86-32, the 64-bit functions use instructions unavailable before the Pentium MMX.
32
 
33
// CompareAndSwapInt32 executes the compare-and-swap operation for an int32 value.
34
func CompareAndSwapInt32(val *int32, old, new int32) (swapped bool)
35
 
36
// CompareAndSwapInt64 executes the compare-and-swap operation for an int64 value.
37
func CompareAndSwapInt64(val *int64, old, new int64) (swapped bool)
38
 
39
// CompareAndSwapUint32 executes the compare-and-swap operation for a uint32 value.
40
func CompareAndSwapUint32(val *uint32, old, new uint32) (swapped bool)
41
 
42
// CompareAndSwapUint64 executes the compare-and-swap operation for a uint64 value.
43
func CompareAndSwapUint64(val *uint64, old, new uint64) (swapped bool)
44
 
45
// CompareAndSwapUintptr executes the compare-and-swap operation for a uintptr value.
46
func CompareAndSwapUintptr(val *uintptr, old, new uintptr) (swapped bool)
47
 
48
// CompareAndSwapPointer executes the compare-and-swap operation for a unsafe.Pointer value.
49
func CompareAndSwapPointer(val *unsafe.Pointer, old, new unsafe.Pointer) (swapped bool)
50
 
51
// AddInt32 atomically adds delta to *val and returns the new value.
52
func AddInt32(val *int32, delta int32) (new int32)
53
 
54
// AddUint32 atomically adds delta to *val and returns the new value.
55
func AddUint32(val *uint32, delta uint32) (new uint32)
56
 
57
// AddInt64 atomically adds delta to *val and returns the new value.
58
func AddInt64(val *int64, delta int64) (new int64)
59
 
60
// AddUint64 atomically adds delta to *val and returns the new value.
61
func AddUint64(val *uint64, delta uint64) (new uint64)
62
 
63
// AddUintptr atomically adds delta to *val and returns the new value.
64
func AddUintptr(val *uintptr, delta uintptr) (new uintptr)
65
 
66
// LoadInt32 atomically loads *addr.
67
func LoadInt32(addr *int32) (val int32)
68
 
69
// LoadInt64 atomically loads *addr.
70
func LoadInt64(addr *int64) (val int64)
71
 
72
// LoadUint32 atomically loads *addr.
73
func LoadUint32(addr *uint32) (val uint32)
74
 
75
// LoadUint64 atomically loads *addr.
76
func LoadUint64(addr *uint64) (val uint64)
77
 
78
// LoadUintptr atomically loads *addr.
79
func LoadUintptr(addr *uintptr) (val uintptr)
80
 
81
// LoadPointer atomically loads *addr.
82
func LoadPointer(addr *unsafe.Pointer) (val unsafe.Pointer)
83
 
84
// StoreInt32 atomically stores val into *addr.
85
func StoreInt32(addr *int32, val int32)
86
 
87
// StoreInt64 atomically stores val into *addr.
88
func StoreInt64(addr *int64, val int64)
89
 
90
// StoreUint32 atomically stores val into *addr.
91
func StoreUint32(addr *uint32, val uint32)
92
 
93
// StoreUint64 atomically stores val into *addr.
94
func StoreUint64(addr *uint64, val uint64)
95
 
96
// StoreUintptr atomically stores val into *addr.
97
func StoreUintptr(addr *uintptr, val uintptr)
98
 
99
// StorePointer atomically stores val into *addr.
100
func StorePointer(addr *unsafe.Pointer, val unsafe.Pointer)
101
 
102
// Helper for ARM.  Linker will discard on other systems
103
func panic64() {
104
        panic("sync/atomic: broken 64-bit atomic operations (buggy QEMU)")
105
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.