Class: SysVIPC::MessageQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/sysvipc.rb

Instance Method Summary collapse

Instance Method Details

#ipc_rmidObject Also known as: rm

Remove. See msgctl(2).



147
148
149
# File 'lib/sysvipc.rb', line 147

def ipc_rmid
  check_result(msgctl(@msgid, IPC_RMID, nil))
end

#ipc_set(msqid_ds) ⇒ Object Also known as: msqid_ds=

Set the Msqid_ds object. See msgctl(2).



136
137
138
139
140
141
142
# File 'lib/sysvipc.rb', line 136

def ipc_set(msqid_ds)
  unless Msqid_ds === msqid_ds
	raise ArgumentError,
	  "argument to ipc_set must be a Msqid_ds"
  end
  check_result(msgctl(@msgid, IPC_SET, msqid_ds))
end

#ipc_statObject Also known as: msqid_ds

Return the Msqid_ds object. See msgctl(2).



127
128
129
130
131
# File 'lib/sysvipc.rb', line 127

def ipc_stat
  res, msqid_ds = msgctl(@msgid, IPC_STAT)
  check_result(res)
  msqid_ds
end

#rcv(type, size, flags = 0) ⇒ Object Also known as: receive

Receive a message of type type, limited to len bytes or fewer. See msgsnd(2).



162
163
164
165
166
# File 'lib/sysvipc.rb', line 162

def rcv(type, size, flags = 0)
  res, mtype, mtext = msgrcv(@msgid, size, type, flags)
  check_result(res)
  mtext
end

#snd(type, text, flags = 0) ⇒ Object Also known as: send

Send a message with type type and text text. See msgsnd(2).



154
155
156
# File 'lib/sysvipc.rb', line 154

def snd(type, text, flags = 0)
  check_result(msgsnd(@msgid, type, text, flags))
end