Put int64 as the first word in Loop (#396)
Fix a bug with ARM and x86-32 and use of atomic operations on 64-bit values. More https://golang.org/pkg/sync/atomic/#pkg-note-BUG
This commit is contained in:
parent
88294b29be
commit
12412b3f58
|
@ -39,9 +39,13 @@ type Task interface {
|
||||||
// aren't ready yet, keyed by their ID, and a channel of tasks that are ready
|
// aren't ready yet, keyed by their ID, and a channel of tasks that are ready
|
||||||
// to finalise on the VM. The channel holding the tasks pending finalising can
|
// to finalise on the VM. The channel holding the tasks pending finalising can
|
||||||
// be buffered or unbuffered.
|
// be buffered or unbuffered.
|
||||||
|
//
|
||||||
|
// Warning: id must be the first field in this struct as it's accessed atomically.
|
||||||
|
// Otherwise, on ARM and x86-32 it will panic.
|
||||||
|
// More information: https://golang.org/pkg/sync/atomic/#pkg-note-BUG.
|
||||||
type Loop struct {
|
type Loop struct {
|
||||||
vm *vm.VM
|
|
||||||
id int64
|
id int64
|
||||||
|
vm *vm.VM
|
||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
tasks map[int64]Task
|
tasks map[int64]Task
|
||||||
ready chan Task
|
ready chan Task
|
||||||
|
|
Loading…
Reference in New Issue