summaryrefslogtreecommitdiff
path: root/xgbgen/context.go
diff options
context:
space:
mode:
authoraarzilli <[email protected]>2016-03-01 15:41:38 +0100
committeraarzilli <[email protected]>2016-03-21 18:51:44 +0100
commit7bf5680164d697fb85b823032e43340db3ec61dc (patch)
treebea4be9d3cb855dd24797392c35c6ad0f5f69d85 /xgbgen/context.go
parentd3d84afd14161dc1c07449d8f9feb2dca6ccc10b (diff)
Read/Write mutex for Extensions map
Diffstat (limited to 'xgbgen/context.go')
-rw-r--r--xgbgen/context.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/xgbgen/context.go b/xgbgen/context.go
index f64f339..f18fd67 100644
--- a/xgbgen/context.go
+++ b/xgbgen/context.go
@@ -99,8 +99,9 @@ func (c *Context) Morph(xmlBytes []byte) {
"on the server.\")", xname)
c.Putln("}")
c.Putln("")
- c.Putln("xgb.ExtLock.Lock()")
+ c.Putln("c.ExtLock.Lock()")
c.Putln("c.Extensions[\"%s\"] = reply.MajorOpcode", xname)
+ c.Putln("c.ExtLock.Unlock()")
c.Putln("for evNum, fun := range xgb.NewExtEventFuncs[\"%s\"] {",
xname)
c.Putln("xgb.NewEventFuncs[int(reply.FirstEvent) + evNum] = fun")
@@ -109,8 +110,6 @@ func (c *Context) Morph(xmlBytes []byte) {
xname)
c.Putln("xgb.NewErrorFuncs[int(reply.FirstError) + errNum] = fun")
c.Putln("}")
- c.Putln("xgb.ExtLock.Unlock()")
- c.Putln("")
c.Putln("return nil")
c.Putln("}")
c.Putln("")