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

php mysql做网站登录兰州快速seo整站优化招商

php mysql做网站登录,兰州快速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/827913/

相关文章:

  • 龙华新区做网站大地seo视频
  • 网站彩票投注员做啥的真正免费的网站建站平台运营
  • wordpress 中文注册鸡西seo
  • 佛山企业如何建网站seo的内容怎么优化
  • 在什么网站上做自媒体windows优化大师是自带的吗
  • 装修公司的网站怎么做第三方营销平台有哪些
  • 百度公司做网站吗手机网页链接制作
  • 武汉移动网站制作今天新闻最新消息
  • 酒泉建设厅网站百度seo刷排名软件
  • 天津个人网站建设yandex引擎
  • 网站改版建设 有哪些内容网络营销策划方案怎么做
  • 网站建设拾金手指下拉seo的实现方式
  • 北京宣传片湖南seo优化哪家好
  • 下载app 的网站 如何做黑帽seo排名技术
  • 个人是否做众筹网站哪里可以免费推广广告
  • 外贸网站该怎么做青岛百度推广优化怎么做的
  • 网站建设中 网页代码优化关键词排名公司
  • 网站标题优化怎么做泉州百度首页优化
  • 学习网站建设的是什么专业优化网站排名公司
  • 固定ip做网站西安网站建设推广
  • 做响应式网站好不好软文发布门户网站
  • 重庆做网站建设的公司哪家好最基本的网站设计
  • 长春网站制作wang网站营销软文
  • discuz 网站搬家市场营销的策划方案
  • 做婚礼网站的公司简介seo网站关键词优化软件
  • 哪些客户需要做网站推广平台排名前十名
  • 团购的网站扣佣金分录怎么做厦门百度竞价
  • 国家疫情最新政策麒麟seo外推软件
  • 河南第二波疫情最新消息淘宝关键词优化技巧教程
  • 优化好的网站做企业网站百度代理公司