You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not unlikely to use callback related verbs from multiple go routines, and since cbMap is global in the package and concurrent map access can be unsafe, perhaps it should be protected by a mutex?
POC code:
package main
import (
"github.com/ibm-messaging/mq-golang/v5/ibmmq"
)
func main() {
for i := 0; i < 5; i++ {
go func() {
qMgr, err := ibmmq.Conn("")
if err != nil {
panic(err)
}
od := ibmmq.NewMQOD()
od.ObjectName = "SYSTEM.DEFAULT.MODEL.QUEUE"
od.ObjectType = ibmmq.MQOT_Q
q, _ := qMgr.Open(od, ibmmq.MQOO_INPUT_SHARED)
cbd := ibmmq.NewMQCBD()
cbd.CallbackFunction = func(a *ibmmq.MQQueueManager,
b *ibmmq.MQObject, c *ibmmq.MQMD, d *ibmmq.MQGMO,
e []byte, f *ibmmq.MQCBC, g *ibmmq.MQReturn) {
}
q.CB(ibmmq.MQOP_REGISTER, cbd, ibmmq.NewMQMD(), ibmmq.NewMQGMO())
qMgr.Ctl(ibmmq.MQOP_START, ibmmq.NewMQCTLO())
qMgr.Ctl(ibmmq.MQOP_STOP, ibmmq.NewMQCTLO())
q.Close(0)
qMgr.Disc()
}()
}
}
>go run -race .
==================
WARNING: DATA RACE
The text was updated successfully, but these errors were encountered:
It is not unlikely to use callback related verbs from multiple go routines, and since
cbMap
is global in the package and concurrent map access can be unsafe, perhaps it should be protected by a mutex?POC code:
The text was updated successfully, but these errors were encountered: