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

wordpress从新安装萌新seo

wordpress从新安装,萌新seo,一级消防工程师考试难吗,免费看今天开始做女神的网站1.前提 前面说到sendMessage携带的delay会被加上SystemClock.uptimeMillis() ,最终赋值给Message的when。 msg.when SystemClock.uptimeMillis() delayMillis; 那么when除了用来在链表里面作为排序依据以外,还在哪里用到了呢? 2.Looper…

1.前提

前面说到sendMessage携带的delay会被加上SystemClock.uptimeMillis() ,最终赋值给Message的when。

msg.when = SystemClock.uptimeMillis() + delayMillis;

那么when除了用来在链表里面作为排序依据以外,还在哪里用到了呢?

2.Looper.loop

首先看下Looper的loop里面,循环取queue的msg,如果msg为null,返回;否则执行msg

public final class Looper {public static void loop() {final Looper me = myLooper();final MessageQueue queue = me.mQueue;for (;;) {Message msg = queue.next(); // might block  获得下一个消息if (msg == null) {// No message indicates that the message queue is quitting.return;}msg.target.dispatchMessage(msg); //执行Messagemsg.recycleUnchecked(); //msg放入缓存}}
}

3.MessageQueue.next

看下queue.next()的实现,会通过when计算下一条消息需要等待的时长。

nextPollTimeoutMillis = (int) Math.min(msg.when - now, Integer.MAX_VALUE); 

public final class MessageQueue {Message next() {// Return here if the message loop has already quit and been disposed.// This can happen if the application tries to restart a looper after quit// which is not supported.final long ptr = mPtr;if (ptr == 0) {return null;}int pendingIdleHandlerCount = -1; // -1 only during first iterationint nextPollTimeoutMillis = 0; //下一条消息等待的时长for (;;) {if (nextPollTimeoutMillis != 0) {Binder.flushPendingCommands();}//等待nextPollTimeoutMillis,不往下执行nativePollOnce(ptr, nextPollTimeoutMillis);//时间到了synchronized (this) {// Try to retrieve the next message.  Return if found.final long now = SystemClock.uptimeMillis();Message prevMsg = null;Message msg = mMessages;if (msg != null) {if (now < msg.when) { //当前时间小于when// Next message is not ready.  Set a timeout to wake up when it is ready.nextPollTimeoutMillis = (int) Math.min(msg.when - now, Integer.MAX_VALUE); //等待时长} else {// Got a message.mBlocked = false;if (prevMsg != null) {prevMsg.next = msg.next;//将msg从链表中移除} else {mMessages = msg.next; //更新表头}msg.next = null;msg.markInUse();return msg;}} else {// No more messages.nextPollTimeoutMillis = -1;}                }// Run the idle handlers.// We only ever reach this code block during the first iteration.for (int i = 0; i < pendingIdleHandlerCount; i++) {final IdleHandler idler = mPendingIdleHandlers[i];mPendingIdleHandlers[i] = null; // release the reference to the handlerboolean keep = false;try {keep = idler.queueIdle();} catch (Throwable t) {Log.wtf(TAG, "IdleHandler threw exception", t);}if (!keep) {synchronized (this) {mIdleHandlers.remove(idler);}}}// Reset the idle handler count to 0 so we do not run them again.pendingIdleHandlerCount = 0;// While calling an idle handler, a new message could have been delivered// so go back and look again for a pending message without waiting.nextPollTimeoutMillis = 0;}}
}

http://www.hkea.cn/news/832561/

相关文章:

  • 郑州网站制作天强科技seo百度发包工具
  • 江阴市住房与建设局网站seo工资多少
  • wordpress image.php南宁百度首页优化
  • 谢家华做网站百度指数与百度搜索量
  • wordpress 安装 ubuntu整站优化代理
  • 做公司网站协议书模板下载百度竞价推广公司
  • 福田蒙派克6座二手值多少钱重庆seo点击工具
  • 有了域名 怎么做网站外贸网站推广方法之一
  • 审美网站长春网站建设路
  • 网站 管理系统域名查询注册信息查询
  • 专业网站设计发展前景推广网站软文
  • 怎么建设seo自己网站网站优化推广教程
  • 最新app开发软件石家庄网站建设seo公司
  • 江苏自助建站系统哪家好推广网站要注意什么
  • 唐河做网站关键字搜索引擎
  • 松江专业做网站公司seo视频教程百度云
  • 淄博品质网站建设竞价推广怎么样
  • 搜狗站群系统资源网站优化排名优化
  • 建设一个网站哪家好网站推广优化的原因
  • 做网站的上海公司有哪些情感链接
  • 梧州做网站建设数字营销公司
  • 加强新闻网站建设建议seo高手培训
  • 安丘网站建设制作怎样制作网页设计
  • 食品网站建设优化案例热门职业培训班
  • 龙华新区做网站大地seo视频
  • 网站彩票投注员做啥的真正免费的网站建站平台运营
  • wordpress 中文注册鸡西seo
  • 佛山企业如何建网站seo的内容怎么优化
  • 在什么网站上做自媒体windows优化大师是自带的吗
  • 装修公司的网站怎么做第三方营销平台有哪些