RussellLuo / timingwheel

Golang implementation of Hierarchical Timing Wheels.
MIT License
656 stars 121 forks source link

修复 32 位机器内存不对齐导致 panic 问题 #14

Closed Allenxuxu closed 4 years ago

Allenxuxu commented 4 years ago

https://github.com/RussellLuo/timingwheel/issues/13

atomic 库中有如下说明:

Bugs ☞ On x86-32, the 64-bit functions use instructions unavailable before the Pentium MMX. On non-Linux ARM, the 64-bit functions use instructions unavailable before the ARMv6k core. On ARM, x86-32, and 32-bit MIPS, it is the caller's responsibility to arrange for 64-bit alignment of 64-bit words accessed atomically. The first word in a variable or in an allocated struct, array, or slice can be relied upon to be 64-bit aligned.

https://godoc.org/sync/atomic#pkg-note-bug

RussellLuo commented 4 years ago

LGTM 😄