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:
parent
114b8168d4
commit
ddd5cd6c12
1 changed files with 9 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue