Unlinking a program from a shared memory segmentΒΆ
unlink_shared_memory() |
Unlinking a program from a shared memory segment |
SYNTAX
unlink_shared_memory(shm_id)
Unlink this program from the shared memory segment specified in shm_id. This is the return value from the function that created or linked to the segment. Avoid creating a second open link to the same shared memory segment in the same program. If this is done, it is necessary to unlink twice, once with each shm_id.
When all programs, including the one that created the segment, have unlinked it or exited, the shared memory is released (except when created with the SHM_PERSIST option).
EXAMPLE
!record Messages {
fieldlist
}
!temp MemNo,,i4
MemNo = link_shared_memory("shmseg001", Messages)
if (MemNo == 0) {
error "Error linking to shared memory segment: errno = " + tostr(sys.Errno)
exit
}
...
!function wintaskEvent(EventCode) {
switch (EventCode) {
case == EV_CLOSE:
unlink_shared_memory(MemNo)
exit
}
}
Shared memory functions |
|
---|---|
Create a shared memory segment |
|
Link to an existing shared memory segment |
|
Read the current field values from shared memory into associated record buffer |
|
Write the current values from associated record buffer into shared memory |
|
Unlock a shared memory segment |
|
Unlink a program from a shared memory segment |
RELATED TOPICS |