• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP event_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中event_free函数的典型用法代码示例。如果您正苦于以下问题:PHP event_free函数的具体用法?PHP event_free怎么用?PHP event_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了event_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: close

 /**
  * 关闭socket
  * @param $socket
  * @param $event
  * @return unknown_type
  */
 static function close($socket, $event = null)
 {
     if ($event) {
         event_del($event);
         event_free($event);
     }
     fclose($socket);
 }
开发者ID:jasonshaw,项目名称:framework-1,代码行数:14,代码来源:Stream.php


示例2: __destruct

 /**
  * Free from loop
  */
 public function __destruct()
 {
     if (!empty($this->event)) {
         event_del($this->event);
         event_free($this->event);
         unset($this->event);
     }
 }
开发者ID:expressif,项目名称:stream,代码行数:11,代码来源:Timer.php


示例3: removeStream

 public function removeStream($stream)
 {
     if (isset($this->events[(int) $stream])) {
         $event = $this->events[(int) $stream];
         event_del($event);
         event_free($event);
         unset($this->events[(int) $stream]);
     }
 }
开发者ID:romainneutron,项目名称:SocketServer,代码行数:9,代码来源:LibEventLoop.php


示例4: free

 public function free()
 {
     if (is_resource($this->ev)) {
         event_del($this->ev);
         event_free($this->ev);
     }
     if (isset($this->conn)) {
         $this->conn->freeRequest($this);
     }
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:10,代码来源:Request.php


示例5: close

 public function close()
 {
     $this->log("close()");
     foreach (array_keys($this->clients) as $id) {
         $this->disconnectClient($id);
     }
     $this->clients = array();
     stream_socket_shutdown($this->socket, STREAM_SHUT_RDWR);
     event_del($this->socket_event);
     event_free($this->socket_event);
     $this->socket_event = null;
 }
开发者ID:hinathan,项目名称:edges-php,代码行数:12,代码来源:Server.php


示例6: service

 private function service($connection, $flag, $base)
 {
     $connectionId = $this->getIdByConnection($connection);
     $buffer = event_buffer_new($connection, array($this, 'onRead'), array($this, 'onWrite'), array($this, 'onError'), $connectionId);
     event_buffer_base_set($buffer, $this->base);
     event_buffer_watermark_set($buffer, EV_READ, 0, 0xffffff);
     event_buffer_priority_set($buffer, 10);
     event_buffer_enable($buffer, EV_READ | EV_WRITE | EV_PERSIST);
     $this->buffers[$connectionId] = $buffer;
     event_del($this->events[$connectionId]);
     event_free($this->events[$connectionId]);
     unset($this->events[$connectionId]);
 }
开发者ID:JimboOneTwo,项目名称:websocket,代码行数:13,代码来源:WebsocketGenericLibevent.php


示例7: onRequest

 public function onRequest($clientSocket, $events, $arg)
 {
     try {
         //$transport = new TBufferedTransport(new TNonblockingSocket($clientSocket));
         $transport = new TNonblockingSocket($clientSocket);
         call_user_func($this->callback, $transport);
     } catch (Exception $e) {
         \event_del($arg[0]);
         \event_free($arg[0]);
         // close socket
         @stream_socket_shutdown($clientSocket, STREAM_SHUT_RDWR);
         @fclose($clientSocket);
         return;
     }
 }
开发者ID:kaiyulee,项目名称:thrift-lib-php,代码行数:15,代码来源:TNonblockingServerSocket.php


示例8: __destruct

 /**
  * Free from loop and close the stream
  */
 public function __destruct()
 {
     if (!empty($this->ev_read)) {
         event_del($this->ev_read);
         event_free($this->ev_read);
         unset($this->ev_read);
     }
     if (!empty($this->ev_write)) {
         event_del($this->ev_write);
         event_free($this->ev_write);
         unset($this->ev_write);
     }
     if (!empty($this->stream)) {
         fclose($this->stream);
         unset($this->stream);
     }
 }
开发者ID:expressif,项目名称:stream,代码行数:20,代码来源:Event.php


示例9: removeStream

 public function removeStream($stream)
 {
     $id = (int) $stream;
     if (isset($this->events[$id])) {
         $event = $this->events[$id];
         unset($this->events[$id], $this->flags[$id], $this->readCallbacks[$id], $this->writeCallbacks[$id]);
         event_del($event);
         event_free($event);
     }
 }
开发者ID:ramiyer,项目名称:react,代码行数:10,代码来源:LibEventLoop.php


示例10: remove

 /**
  * Unregister a stream
  * 
  * @param   resource    $stream
  * @param   integer     $type
  * @return  this
  */
 public function remove($stream, $type = null)
 {
     $i = (int) $stream;
     $type = is_null($type) ? array(self::READ, self::WRITE) : array($type);
     // using libevent
     if ($this->evbase) {
         foreach ($type as $t) {
             if (isset($this->streams[$t])) {
                 event_del($this->streams[$t][$i]);
                 event_free($this->streams[$t][$i]);
             }
         }
     } else {
         foreach ($type as $t) {
             unset($this->streams[$t][$i], $this->handlers[$t][$i]);
         }
     }
     return $this;
 }
开发者ID:rustyrobotmedia,项目名称:Plus,代码行数:26,代码来源:Plus.php


示例11: disable

 /**
  * Disable all events of sockets
  * @return void
  */
 public function disable()
 {
     return;
     // possible critical bug
     for (; sizeof($this->socketEvents);) {
         if (!is_resource($ev = array_pop($this->socketEvents))) {
             continue;
         }
         event_del($ev);
         event_free($ev);
     }
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:16,代码来源:ConnectionPool.php


示例12: cancelTimer

 /**
  * {@inheritdoc}
  */
 public function cancelTimer(TimerInterface $timer)
 {
     if ($this->isTimerActive($timer)) {
         $event = $this->timerEvents[$timer];
         event_del($event);
         event_free($event);
         $this->timerEvents->detach($timer);
     }
 }
开发者ID:huyanping,项目名称:event-loop,代码行数:12,代码来源:LibEventLoop.php


示例13: _closeSocket

 private function _closeSocket($socket, $event = null)
 {
     if ($event) {
         \event_del($event);
         \event_free($event);
     }
     \stream_socket_shutdown($socket, STREAM_SHUT_RDWR);
     \fclose($socket);
 }
开发者ID:tempbottle,项目名称:zphp,代码行数:9,代码来源:Php.php


示例14: destroy

 /**
  * Destroy event handle
  *
  * @return void
  */
 private function destroy()
 {
     if ($this->handle) {
         event_del($this->handle);
         event_free($this->handle);
         $this->handle = null;
     }
 }
开发者ID:edefimov,项目名称:async-sockets,代码行数:13,代码来源:LeEvent.php


示例15: __destruct

 /**
  * @codeCoverageIgnore
  */
 public function __destruct()
 {
     foreach ($this->events as $event) {
         event_free($event);
     }
 }
开发者ID:kayandrae,项目名称:icicle,代码行数:9,代码来源:SignalManager.php


示例16: closeConnection

 public function closeConnection($connId)
 {
     if (Daemon::$settings['logevents']) {
         Daemon::log('[WORKER ' . Daemon::$worker->pid . '] closeConnection(' . $connId . ').');
     }
     if (!isset($this->buf[$connId])) {
         return;
     }
     if (isset($this->readEvents[$connId])) {
         event_del($this->readEvents[$connId]);
         event_free($this->readEvents[$connId]);
         unset($this->readEvents[$connId]);
     }
     event_buffer_free($this->buf[$connId]);
     if (Daemon::$useSockets) {
         socket_close(Daemon::$worker->pool[$connId]);
     } else {
         fclose(Daemon::$worker->pool[$connId]);
     }
     unset(Daemon::$worker->pool[$connId]);
     unset(Daemon::$worker->poolApp[$connId]);
     unset(Daemon::$worker->readPoolState[$connId]);
     unset($this->buf[$connId]);
     unset($this->poolQueue[$connId]);
     unset(Daemon::$worker->poolState[$connId]);
 }
开发者ID:svcorp77,项目名称:phpdaemon,代码行数:26,代码来源:asyncServer.class.php


示例17: closeSockets

 public function closeSockets()
 {
     foreach (Daemon::$socketEvents as $k => $ev) {
         event_del($ev);
         event_free($ev);
         unset($this->socketEvents[$k]);
     }
     foreach (Daemon::$sockets as $k => &$s) {
         if (Daemon::$useSockets) {
             socket_close($s[0]);
         } else {
             fclose($s[0]);
         }
         unset(Daemon::$sockets[$k]);
     }
 }
开发者ID:svcorp77,项目名称:phpdaemon,代码行数:16,代码来源:Daemon_WorkerThread.class.php


示例18: cancelTimer

 public function cancelTimer($signature)
 {
     if (isset($this->timers[$signature])) {
         $timer = $this->timers[$signature];
         $timer->cancelled = true;
         event_del($timer->resource);
         event_free($timer->resource);
         unset($this->timers[$signature]);
     }
 }
开发者ID:unkerror,项目名称:Budabot,代码行数:10,代码来源:LibEventLoop.php


示例19: close

 /**
  * Close the connection
  * @param integer Connection's ID
  * @return void
  */
 public function close()
 {
     if (!isset($this->buffer)) {
         return;
     }
     if (isset($this->event)) {
         event_del($this->event);
         event_free($this->event);
         $this->event = null;
     }
     event_buffer_free($this->buffer);
     $this->buffer = null;
     if (isset($this->fd)) {
         $this->closeFd();
     }
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:21,代码来源:IOStream.php


示例20: become_intern

 private function become_intern($request_message)
 {
     $intern = new Prefork_Intern($this);
     $pid = $this->fork_process();
     if ($pid === 0) {
         // Interns only past this point
         event_base_loopbreak($this->event_base);
         event_base_reinit($this->event_base);
         foreach ($this->events as $i => $event) {
             event_del($event);
             event_free($event);
             unset($this->events[$i]);
         }
         event_base_free($this->event_base);
         $intern->start_request($request_message);
         $this->intern = $intern;
         return true;
     }
     $this->intern_pid = $pid;
     if (!$this->single_interns) {
         $this->make_offer();
     }
     return false;
 }
开发者ID:Aishwariya,项目名称:prefork,代码行数:24,代码来源:prefork.php



注:本文中的event_free函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP event_log_log函数代码示例发布时间:2022-05-15
下一篇:
PHP event_espresso_require_gateway函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap