mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-23 17:59:41 +02:00
multi: 64bit aligment of atomic vars on arm/x86-32
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
d2bcb708f3
commit
3be08e69cf
@@ -51,8 +51,8 @@ var (
|
||||
// and the current block height. DecayedLog wraps boltdb for simplicity and
|
||||
// batches writes to the database to decrease write contention.
|
||||
type DecayedLog struct {
|
||||
started int32
|
||||
stopped int32
|
||||
started int32 // To be used atomically.
|
||||
stopped int32 // To be used atomically.
|
||||
|
||||
dbPath string
|
||||
|
||||
|
@@ -60,8 +60,8 @@ type MailBox interface {
|
||||
// memoryMailBox is an implementation of the MailBox struct backed by purely
|
||||
// in-memory queues.
|
||||
type memoryMailBox struct {
|
||||
started uint32
|
||||
stopped uint32
|
||||
started uint32 // To be used atomically.
|
||||
stopped uint32 // To be used atomically.
|
||||
|
||||
wireMessages *list.List
|
||||
wireHead *list.Element
|
||||
|
@@ -100,8 +100,8 @@ func (m *mockForwardingLog) AddForwardingEvents(events []channeldb.ForwardingEve
|
||||
}
|
||||
|
||||
type mockServer struct {
|
||||
started int32
|
||||
shutdown int32
|
||||
started int32 // To be used atomically.
|
||||
shutdown int32 // To be used atomically.
|
||||
wg sync.WaitGroup
|
||||
quit chan struct{}
|
||||
|
||||
|
@@ -17,6 +17,19 @@ import (
|
||||
// to signal the number of slots available, and a condition variable to allow
|
||||
// the packetQueue to know when new items have been added to the queue.
|
||||
type packetQueue struct {
|
||||
// queueLen is an internal counter that reflects the size of the queue
|
||||
// at any given instance. This value is intended to be use atomically
|
||||
// as this value is used by internal methods to obtain the length of
|
||||
// the queue w/o grabbing the main lock. This allows callers to avoid a
|
||||
// deadlock situation where the main goroutine is attempting a send
|
||||
// with the lock held.
|
||||
queueLen int32
|
||||
|
||||
// totalHtlcAmt is the sum of the value of all pending HTLC's currently
|
||||
// residing within the overflow queue. This value should only read or
|
||||
// modified *atomically*.
|
||||
totalHtlcAmt int64
|
||||
|
||||
queue []*htlcPacket
|
||||
|
||||
wg sync.WaitGroup
|
||||
@@ -33,20 +46,7 @@ type packetQueue struct {
|
||||
// commitment transaction.
|
||||
outgoingPkts chan *htlcPacket
|
||||
|
||||
// totalHtlcAmt is the sum of the value of all pending HTLC's currently
|
||||
// residing within the overflow queue. This value should only read or
|
||||
// modified *atomically*.
|
||||
totalHtlcAmt int64
|
||||
|
||||
quit chan struct{}
|
||||
|
||||
// queueLen is an internal counter that reflects the size of the queue
|
||||
// at any given instance. This value is intended to be use atomically
|
||||
// as this value is used by internal methods to obtain the length of
|
||||
// the queue w/o grabbing the main lock. This allows callers to avoid a
|
||||
// deadlock situation where the main goroutine is attempting a send
|
||||
// with the lock held.
|
||||
queueLen int32
|
||||
}
|
||||
|
||||
// newPacketQueue returns a new instance of the packetQueue. The maxFreeSlots
|
||||
|
@@ -153,8 +153,8 @@ type Config struct {
|
||||
// HTLCs, forwarding HTLCs initiated from within the daemon, and finally
|
||||
// notifies users local-systems concerning their outstanding payment requests.
|
||||
type Switch struct {
|
||||
started int32
|
||||
shutdown int32
|
||||
started int32 // To be used atomically.
|
||||
shutdown int32 // To be used atomically.
|
||||
wg sync.WaitGroup
|
||||
quit chan struct{}
|
||||
|
||||
|
Reference in New Issue
Block a user