summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Gerus <rgerus@dpd.com.pl>2015-12-09 08:52:02 +0100
committerRobert Gerus <rgerus@dpd.com.pl>2015-12-09 08:52:02 +0100
commit3d21ac9c7bd33a37089d7ee7b18c8f5caf26e5c1 (patch)
tree433e388ada43f1945e590a973724b21344307da3
parent421c9394a784707ca87c48f87c45d01bc3323059 (diff)
downloadgorepost-3d21ac9c7bd33a37089d7ee7b18c8f5caf26e5c1.tar.gz
gorepost-3d21ac9c7bd33a37089d7ee7b18c8f5caf26e5c1.tar.bz2
gorepost-3d21ac9c7bd33a37089d7ee7b18c8f5caf26e5c1.tar.xz
gorepost-3d21ac9c7bd33a37089d7ee7b18c8f5caf26e5c1.zip
Fix locking.
-rw-r--r--bot/jan.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/bot/jan.go b/bot/jan.go
index 707a4a4..2feb0eb 100644
--- a/bot/jan.go
+++ b/bot/jan.go
@@ -17,13 +17,17 @@ import (
var objects []string
var predicates []string
-var janLock sync.Mutex
+var janLock sync.RWMutex
func jan(output func(irc.Message), msg irc.Message) {
args := strings.Split(msg.Trailing, " ")
if args[0] != ":jan" {
return
}
+
+ janLock.RLock()
+ defer janLock.RUnlock()
+
var predicate string
var object string