2
0
Fork 0
mirror of https://github.com/ii64/sonic.git synced 2026-06-21 00:46:43 +08:00

fix:(loader) add mutex lock for registerModule (#388)

This commit is contained in:
Yi Duan 2023-03-20 21:10:22 +08:00 committed by GitHub
parent 114b8168d4
commit ddd5cd6c12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,7 @@
package loader
import (
`sync`
_ `unsafe`
)
@ -24,9 +25,13 @@ import (
//goland:noinspection GoUnusedGlobalVariable
var lastmoduledatap *moduledata
var moduledataMux sync.Mutex
func registerModule(mod *moduledata) {
moduledataMux.Lock()
lastmoduledatap.next = mod
lastmoduledatap = mod
moduledataMux.Unlock()
}
//go:linkname moduledataverify1 runtime.moduledataverify1