syucream/posix_mq

Importing Error constants into wrapper.go would be useful.

joe-at-startupmedia opened this issue · 1 comments

Currently I am catching the error like this:

  msg, _, err := mq_send.Receive()
  if err != nil {
    //EAGAIN simply means the queue is empty
    if strings.Contains(err.Error(), "resource temporarily unavailable") {
      pmond.Log.Debug("queue is empty")
      return
    }

https://man7.org/linux/man-pages/man3/mq_receive.3.html#ERRORS

All of the possible errors thrown by mqueue.c are available in the syscall package and are handled as such:

    if errors.Is(err, syscall.EAGAIN) {
        pmond.Log.Debug("the queue is empty")
        return
    }