class SysVIPC::SharedMemory
Attributes
shmid[R]
Public Class Methods
new(key, size, flags = 0)
click to toggle source
Return a SharedMemory
object encapsulating a shared memory segment of size
bytes associated with key
. See shmget(2).
# File lib/SysVIPC.rb 308 def initialize(key, size, flags = 0) 309 @shmid = shmget(key, size, flags) 310 check_result(@shmid) 311 end
Public Instance Methods
attach(shmaddr = nil, flags = 0)
click to toggle source
Attach to a shared memory address object and return it. See shmat(2). If shmaddr
is nil, the shared memory is attached at the first available address as selected by the system. See shmat(2).
# File lib/SysVIPC.rb 349 def attach(shmaddr = nil, flags = 0) 350 shmaddr = shmat(@shmid, shmaddr, flags) 351 check_result(shmaddr) 352 shmaddr 353 end
detach(shmaddr)
click to toggle source
Detach the Shmaddr
object shmaddr
. See shmdt(2).
# File lib/SysVIPC.rb 357 def detach(shmaddr) 358 check_result(shmdt(shmaddr)) 359 end
ipc_rmid()
click to toggle source
Remove. See shmctl(2).
# File lib/SysVIPC.rb 339 def ipc_rmid 340 check_result(shmctl(@shmid, IPC_RMID, nil)) 341 end
Also aliased as: rm
ipc_set(shmid_ds)
click to toggle source
Set the Shmid_ds
object. See shmctl(2).
# File lib/SysVIPC.rb 328 def ipc_set(shmid_ds) 329 unless Shmid_ds === shmid_ds 330 raise ArgumentError, 331 "argument to ipc_set must be a Shmid_ds" 332 end 333 check_result(shmctl(@shmid, IPC_SET, shmid_ds)) 334 end
Also aliased as: shmid_ds=