Пример #1
0
// GetMsgQueue creates or retrieves a message queue id for a given IPC key.
func GetMsgQueue(key int64, flags *MQFlags) (MessageQueue, error) {
	rc, err := C.msgget(C.key_t(key), C.int(flags.flags()))
	if rc == -1 {
		return -1, err
	}
	return MessageQueue(rc), nil
}
Пример #2
0
// msgget(2)
// int msgget(key_t key, int msgflg);
func msgget(key int, mode int) (int, error) {
	res, err := C.msgget(C.key_t(key), C.int(mode))

	if err != nil {
		return -1, err
	}

	return int(res), nil
}