mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
🎨 Improve kernel stability by eliminating some data races https://github.com/siyuan-note/siyuan/issues/9842
This commit is contained in:
parent
dbd52231e9
commit
071f3f9af8
2 changed files with 7 additions and 7 deletions
|
|
@ -41,7 +41,7 @@ var (
|
|||
TesseractMaxSize = 2 * 1000 * uint64(1000)
|
||||
AssetsTexts = map[string]string{}
|
||||
AssetsTextsLock = sync.Mutex{}
|
||||
AssetsTextsChanged = false
|
||||
AssetsTextsChanged = atomic.Bool{}
|
||||
|
||||
TesseractLangs []string
|
||||
)
|
||||
|
|
@ -50,7 +50,7 @@ func SetAssetText(asset, text string) {
|
|||
AssetsTextsLock.Lock()
|
||||
AssetsTexts[asset] = text
|
||||
AssetsTextsLock.Unlock()
|
||||
AssetsTextsChanged = true
|
||||
AssetsTextsChanged.Store(true)
|
||||
}
|
||||
|
||||
func ExistsAssetText(asset string) (ret bool) {
|
||||
|
|
@ -76,7 +76,7 @@ func GetAssetText(asset string, force bool) (ret string) {
|
|||
AssetsTexts[asset] = ret
|
||||
AssetsTextsLock.Unlock()
|
||||
if "" != ret {
|
||||
AssetsTextsChanged = true
|
||||
AssetsTextsChanged.Store(true)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue