diff options
| author | aarzilli <[email protected]> | 2016-03-01 15:41:38 +0100 |
|---|---|---|
| committer | aarzilli <[email protected]> | 2016-03-21 18:51:44 +0100 |
| commit | 7bf5680164d697fb85b823032e43340db3ec61dc (patch) | |
| tree | bea4be9d3cb855dd24797392c35c6ad0f5f69d85 /xgbgen/go_request_reply.go | |
| parent | d3d84afd14161dc1c07449d8f9feb2dca6ccc10b (diff) | |
Read/Write mutex for Extensions map
Diffstat (limited to 'xgbgen/go_request_reply.go')
| -rw-r--r-- | xgbgen/go_request_reply.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/xgbgen/go_request_reply.go b/xgbgen/go_request_reply.go index c1b9ee9..396305e 100644 --- a/xgbgen/go_request_reply.go +++ b/xgbgen/go_request_reply.go @@ -79,6 +79,8 @@ func (r *Request) CheckExt(c *Context) { if !c.protocol.isExt() { return } + c.Putln("c.ExtLock.RLock()") + c.Putln("defer c.ExtLock.RUnlock()") c.Putln("if _, ok := c.Extensions[\"%s\"]; !ok {", c.protocol.ExtXName) c.Putln("panic(\"Cannot issue request '%s' using the uninitialized "+ "extension '%s'. %s.Init(connObj) must be called first.\")", @@ -169,7 +171,9 @@ func (r *Request) WriteRequest(c *Context) { c.Putln("buf := make([]byte, size)") c.Putln("") if c.protocol.isExt() { + c.Putln("c.ExtLock.RLock()") c.Putln("buf[b] = c.Extensions[\"%s\"]", c.protocol.ExtXName) + c.Putln("c.ExtLock.RUnlock()") c.Putln("b += 1") c.Putln("") } |
