谷歌镜像 伍佰目录 短网址
  当前位置:海洋目录网 » 站长资讯 » 站长资讯 » 文章详细 订阅RssFeed

PHP - Manual: shm_remove

来源:网络转载 浏览:36603次 时间:2023-12-21
SysvMessageQueue » « shm_remove_var
  • PHP 手册
  • 函数参考
  • 进程控制扩展
  • Semaphore
  • Semaphore 函数

shm_remove

(PHP 4, PHP 5, PHP 7, PHP 8)

shm_remove — Removes shared memory from Unix systems

说明

shm_remove(SysvSharedMemory $shm): bool

shm_remove() removes the shared memory shm. All data will be destroyed.

参数

shm

A shared memory segment obtained from shm_attach().

返回值

成功时返回 true, 或者在失败时返回 false

更新日志

版本 说明
8.0.0 shm expects a SysvSharedMemory instance now; previously, a resource was expected.

参见

  • shm_remove_var() - Removes a variable from shared memory
add a note

User Contributed Notes 3 notes

up down 1 aaron DURP segura DURP gmail DURP com15 years ago It appears that you must be connected to the shm segment in order to remove it.

<?php
shm_remove($shm);
shm_detach($shm);
?>

works, while

<?php
shm_detach($shm);
shm_remove($shm);
?>

produces "Warning: shm_remove(): The parameter is not a valid shm_identifier ..."
up down 0 HansRich8 years ago WARNING: this function WILL NOT destroy the memory segment if there are other processes attached to it, but it will return TRUE anyways!

You will have to try to access the segment again after destroying it to make sure it was relly destroyed.
up down -1 cu at ulakbim dot gov dot tr22 years ago Though it says **shm_identifier** in
  int shm_remove(int shm_identifier);
and
  shm_attach() returns an **id** that that can be used to access the System V...

a snippet like this:
<?php
  $key = 1234;
  $shm=shm_attach($key);
  // do whatever...
  shm_remove($shm);
?>

produces an error like
Warning: 2(which is the value of $shm) is not a existing SysV shared memory key in /usr/cu/web/sema.php on line 44...

The documentation confused me a bit. I thought shm_remove would get the shm handle/id that returns from shm_attach, not the key given to shm_attach. So, use instead:
  shm_remove($key);

which is what is intended indeed.
add a note

官方地址:https://www.php.net/manual/en/function.shm-remove.php

  推荐站点

  • At-lib分类目录At-lib分类目录

    At-lib网站分类目录汇集全国所有高质量网站,是中国权威的中文网站分类目录,给站长提供免费网址目录提交收录和推荐最新最全的优秀网站大全是名站导航之家

    www.at-lib.cn
  • 中国链接目录中国链接目录

    中国链接目录简称链接目录,是收录优秀网站和淘宝网店的网站分类目录,为您提供优质的网址导航服务,也是网店进行收录推广,站长免费推广网站、加快百度收录、增加友情链接和网站外链的平台。

    www.cnlink.org
  • 35目录网35目录网

    35目录免费收录各类优秀网站,全力打造互动式网站目录,提供网站分类目录检索,关键字搜索功能。欢迎您向35目录推荐、提交优秀网站。

    www.35mulu.com
  • 就要爱网站目录就要爱网站目录

    就要爱网站目录,按主题和类别列出网站。所有提交的网站都经过人工审查,确保质量和无垃圾邮件的结果。

    www.912219.com
  • 伍佰目录伍佰目录

    伍佰网站目录免费收录各类优秀网站,全力打造互动式网站目录,提供网站分类目录检索,关键字搜索功能。欢迎您向伍佰目录推荐、提交优秀网站。

    www.wbwb.net