add init for global FullData

This commit is contained in:
nytpu
2021-03-18 10:18:54 -06:00
parent 593c1288bc
commit e1a5c68ec7
2 changed files with 87 additions and 2 deletions
+24 -2
View File
@@ -8,8 +8,6 @@
// terms of the GNU General Public License Version 3.0.
// https://www.gnu.org/licenses/gpl-3.0-standalone.html
// package core implements the structs and other necessary resources for storing
// and managing feeds and pages
package core
import (
@@ -110,6 +108,30 @@ func (f *Feed) Swap(i, j int) {
f.Items[i], f.Items[j] = f.Items[j], f.Items[i]
}
// Lock locks both feed and page mutexes.
func (j *JsonData) Lock() {
j.FeedsMu.Lock()
j.PagesMu.Lock()
}
// Unlock unlocks both feed and page mutexes.
func (j *JsonData) Unlock() {
j.FeedsMu.Unlock()
j.PagesMu.Unlock()
}
// RLock read-locks both feed and page mutexes.
func (j *JsonData) RLock() {
j.FeedsMu.RLock()
j.PagesMu.RLock()
}
// RUnlock read-unlocks both feed and page mutexes.
func (j *JsonData) RUnlock() {
j.FeedsMu.RUnlock()
j.PagesMu.RUnlock()
}
// PageEntry is a single item on a subscriptions page. It is used for both feeds
// and pages.
type PageEntry struct {