当前位置: 首页 > news >正文

wordpress 值班seo推广绩效考核指标是什么

wordpress 值班,seo推广绩效考核指标是什么,网络代理端口是什么,遵义企业网络推广方案简介 Timer 类是 muduo 网络库中的一个定时器类,用于在指定的时间间隔后执行某个任务。 Timer 类提供了一系列的方法来创建、启动、停止和删除定时器,以及设置定时器的时间间隔和回调函数等。 在 muduo 网络库中,Timer 类被广泛应用于各种…

简介

Timer 类是 muduo 网络库中的一个定时器类,用于在指定的时间间隔后执行某个任务。

Timer 类提供了一系列的方法来创建、启动、停止和删除定时器,以及设置定时器的时间间隔和回调函数等。

在 muduo 网络库中,Timer 类被广泛应用于各种网络任务中,例如定期发送心跳包、更新缓存、清理资源等。通过使用 Timer 类,我们可以方便地实现定时任务,提高网络应用程序的可靠性和稳定性。

以下是 muduo 网络库中 Timer 类的主要方法和功能:

  1. Timer::start():启动定时器,在指定的时间间隔后调用回调函数。
  2. Timer::stop():停止定时器,不再执行定时任务。
  3. Timer::restart():重新启动定时器,重新开始执行定时任务。
  4. Timer::reset():重新设置定时器的时间间隔和回调函数。
  5. Timer::getExpiryTime():获取定时器的到期时间。

通过使用 Timer 类,我们可以方便地实现各种定时任务,提高网络应用程序的可靠性和稳定性。同时,Timer 类也提供了一些高级功能,例如可以设置多个定时器,以及在多个线程中安全地使用定时器等。

源码剖析

Timer.h

// Copyright 2010, Shuo Chen.  All rights reserved.
// http://code.google.com/p/muduo/
//
// Use of this source code is governed by a BSD-style license
// that can be found in the License file.// Author: Shuo Chen (chenshuo at chenshuo dot com)
//
// This is an internal header file, you should not include this.#ifndef MUDUO_NET_TIMER_H
#define MUDUO_NET_TIMER_H#include "muduo/base/Atomic.h"
#include "muduo/base/Timestamp.h"
#include "muduo/net/Callbacks.h"namespace muduo
{
namespace net
{///
/// Internal class for timer event.
///
class Timer : noncopyable
{public:Timer(TimerCallback cb, Timestamp when, double interval): callback_(std::move(cb)),expiration_(when),interval_(interval),repeat_(interval > 0.0),sequence_(s_numCreated_.incrementAndGet()){ }//调用回调函数void run() const{callback_();}Timestamp expiration() const  { return expiration_; }bool repeat() const { return repeat_; }int64_t sequence() const { return sequence_; }//刷新时间戳void restart(Timestamp now);static int64_t numCreated() { return s_numCreated_.get(); }private://超时回调函数const TimerCallback callback_;//时间戳Timestamp expiration_;//时间间隔const double interval_;//是否重复const bool repeat_;//顺序编号const int64_t sequence_;//生成顺序的编号static AtomicInt64 s_numCreated_;
};}  // namespace net
}  // namespace muduo#endif  // MUDUO_NET_TIMER_H

Timer.cc

// Copyright 2010, Shuo Chen.  All rights reserved.
// http://code.google.com/p/muduo/
//
// Use of this source code is governed by a BSD-style license
// that can be found in the License file.// Author: Shuo Chen (chenshuo at chenshuo dot com)#include "muduo/net/Timer.h"using namespace muduo;
using namespace muduo::net;AtomicInt64 Timer::s_numCreated_;void Timer::restart(Timestamp now)
{if (repeat_){expiration_ = addTime(now, interval_);}else{expiration_ = Timestamp::invalid();}
}
http://www.rdtb.cn/news/17903.html

相关文章:

  • 网站建设的目的只是开展网络营销网站内容如何优化
  • 苏州网站推广电话网上交易平台
  • 石家庄市市政建设总公司网站网站模板中心
  • 移动端网站制作最近发生的新闻事件
  • 百度网站地图怎么做推广怎么做才可以赚钱
  • 下载安装微信南京百度推广优化排名
  • wordpress btime广西壮族自治区在线seo关键词排名优化
  • 推广策略方案seo竞价
  • 杭州建设信用平台关键词优化价格
  • 学生做的网站能攻击企业网站建设的目的
  • 云服务器 做网站公众号微博seo
  • 杭州网站建设哪里好网络营销优化培训
  • wordpress同标题关键字澳门seo关键词排名
  • 哈尔滨做平台网站平台公司哪家好搜索引擎优化行业
  • 锚文本外链查询网站国内搜索引擎排行榜
  • 佛山微信网站建设哪家好长尾词挖掘工具爱站网
  • 做网站的价格表推广小程序
  • 做境外的赌博网站违法么图片外链生成工具在线
  • 网站建设的文章视频广告
  • 汇泽网站建设虚拟主机搭建网站
  • 佛山网站开发哪家好搜狗seo软件
  • 上海做网站去哪里西安seo主管
  • 如何做网站品类河源网站seo
  • wordpress网站网络平台推广具体是怎么推广
  • wordpress美女站主题sem托管公司
  • 贵阳有做网站的公司吗百度云电脑版网站入口
  • 小程序生成器百度推广怎么优化关键词的质量
  • 九一制作网站百度推广个人能开户吗
  • 用vue框架做的网站seo门户
  • 天猫网站建设的意义天津百度关键词排名