diff options
| author | nytpu <alex@nytpu.com> | 2021-03-18 10:18:54 -0600 |
|---|---|---|
| committer | nytpu <alex@nytpu.com> | 2021-03-18 10:18:54 -0600 |
| commit | e1a5c68ec75b1cbae5b4bfb788412512c557e9ad (patch) | |
| tree | b1f8f380dd9a4bbe591b2f6465a839f025f65fe7 /core/structs.go | |
| parent | 593c1288bc2e775cc5d116cb861141b752119d56 (diff) | |
add init for global FullData
Diffstat (limited to 'core/structs.go')
| -rw-r--r-- | core/structs.go | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/core/structs.go b/core/structs.go index abebed0..28915e1 100644 --- a/core/structs.go +++ b/core/structs.go @@ -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 { |
