Skip to content

Data race with endian var #140

@ravellan

Description

@ravellan

While testing my own code for data races I discovered a data race warning with writes to the endian variable in every call to some of the package methods.

To reproduce

func main() {
	for i := 0; i <= 10; i++ {
		go ibmmq.NewMQCFH()
	}
	time.Sleep(1 * time.Second)
}
$ go run -race ibmmq_race.go 
==================
WARNING: DATA RACE
Write at 0x00000089ead0 by goroutine 7:
  github.com/ibm-messaging/mq-golang/ibmmq.NewMQCFH()
      /go/src/github.com/ibm-messaging/mq-golang/ibmmq/mqiPCF.go:85 +0x134

Previous write at 0x00000089ead0 by goroutine 8:
  github.com/ibm-messaging/mq-golang/ibmmq.NewMQCFH()
      /go/src/github.com/ibm-messaging/mq-golang/ibmmq/mqiPCF.go:85 +0x134

Perhaps endian can be set as a constant in respective cmqc_ file instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions