Read/Write mutex for Extensions map

This commit is contained in:
aarzilli
2016-03-01 15:41:38 +01:00
committed by Přemysl Janouch
parent baff8c1906
commit becaf43dcb
29 changed files with 2526 additions and 103 deletions

View File

@@ -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("")