1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-14 17:52:10 -04:00

core: refactor to use a generic-compatible syncmap

This commit is contained in:
bbedward
2025-11-15 19:44:47 -05:00
parent 4cb652abd9
commit 67557555f2
36 changed files with 936 additions and 543 deletions

View File

@@ -356,7 +356,7 @@ func (m *Manager) Subscribe(id string) chan SessionState {
func (m *Manager) Unsubscribe(id string) {
if val, ok := m.subscribers.LoadAndDelete(id); ok {
close(val.(chan SessionState))
close(val)
}
}
@@ -389,8 +389,7 @@ func (m *Manager) notifier() {
continue
}
m.subscribers.Range(func(key, value interface{}) bool {
ch := value.(chan SessionState)
m.subscribers.Range(func(key string, ch chan SessionState) bool {
select {
case ch <- currentState:
default:
@@ -572,8 +571,7 @@ func (m *Manager) Close() {
m.releaseSleepInhibitor()
m.subscribers.Range(func(key, value interface{}) bool {
ch := value.(chan SessionState)
m.subscribers.Range(func(key string, ch chan SessionState) bool {
close(ch)
m.subscribers.Delete(key)
return true