diff options
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 { |
