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

动易网站免费版哪个网站可以做免费商业推广

动易网站免费版,哪个网站可以做免费商业推广,建网页和网站的区别,海口建设文章目录 简要概述代码记录 简要概述 简单记录android中native关于thread的使用 源码位置: system\core\libutils\include\utils\Thread.h system\core\libutils\Threads.cppclass Thread : virtual public RefBase Thread继承RefBase,有以下的一些特性…

文章目录

  • 简要概述
  • 代码记录

简要概述

简单记录android中native关于thread的使用
源码位置:

system\core\libutils\include\utils\Thread.h
system\core\libutils\Threads.cppclass Thread : virtual public RefBase
Thread继承RefBase,有以下的一些特性
// Invoked after creation of initial strong pointer/reference.
virtual void            onFirstRef();

代码记录

main.cpp

#include <utils/Log.h>
#include <pthread.h>
#include "TestThread.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "hello_test"
using namespace android;int main(int args,char** argv) {ALOGD("main start TestThread");// TestThreadsp<TestThread> testThread = new TestThread;testThread->run("TestThread", PRIORITY_URGENT_DISPLAY);while(1){if(!testThread->isRunning()){break;}}ALOGD("main end");return 0;
}

Android.bp

cc_binary{name:"hello_test",srcs:["main.cpp","TestThread.cpp",],shared_libs:["liblog","libutils",],cflags: ["-Wno-error","-Wno-unused-parameter",],
}

TestThread.h

//
// Created by xxx on 25-6-8.
//#ifndef ANDROID_TESTTHREAD_H
#define ANDROID_TESTTHREAD_H
#include <utils/threads.h>
#include <utils/Log.h>namespace android {class TestThread : public Thread {public:TestThread();virtual void        onFirstRef();virtual status_t    readyToRun();virtual bool        threadLoop();virtual void        requestExit();private:int cnt = 0;};
}
#endif //ANDROID_TESTTHREAD_H

TestThread.cpp

//
// Created by xxx on 25-6-8.
//
#include "TestThread.h"
namespace android{TestThread::TestThread():Thread(false) {ALOGD("TestThread");}void TestThread::onFirstRef(){ALOGD("onFirstRef");}status_t  TestThread::readyToRun(){ALOGD("readyToRun");return OK;}bool TestThread::threadLoop() {cnt++;ALOGD("threadLoop cnt = %d",cnt);if(cnt >= 20){return false;}return true;}void  TestThread::requestExit(){ALOGD("requestExit");}}

日志打印如下所示

06-14 22:29:28.500  2094  2094 D hello_test: main start TestThread
06-14 22:29:28.500  2094  2094 D hello_test: TestThread
06-14 22:29:28.500  2094  2094 D hello_test: onFirstRef
06-14 22:29:28.501  2094  2096 D hello_test: readyToRun
06-14 22:29:28.502  2094  2096 D hello_test: threadLoop cnt = 1
...
06-14 22:29:28.505  2094  2096 D hello_test: threadLoop cnt = 20
06-14 22:29:28.505  2094  2094 D hello_test: main end

函数执行顺序 TestThread->onFirstRef->readyToRun->threadLoop

http://www.yayakq.cn/news/772656/

相关文章:

  • 企业建站的作用是什么网页qq邮箱
  • 学校网站建设怎么样深圳双区建设
  • 佛山网站seo公司成都易站网站建设
  • 湖北做网站推广硅云买域名做网站
  • 重庆网站建设哪个公司好网站建设需求公司内部调查
  • 网站开发公司会计有没有做网站
  • 科技杭州网站建设写网页的素材图片
  • 开封做网站公司flarum和wordpress
  • seo网站平台网站建设相关知识博客
  • 九里微网站开发wordpress 归档文章
  • 怎样找到网站后台入口网站开发后台php技术
  • 做网站是不是需要服务器电商网站开发实验报告
  • 个人网站导航模版南充公司做网站
  • 昆明企业建站程序wordpress 维护
  • 怎么做网站的搜索功能网站做扫一扫
  • 服装网站推广计划书范文500字西宁做网站建设公司哪家好
  • 网站的大小商城网站建设最好的公司
  • 企业网站推广哪个公司好丹阳建设局网站
  • 织梦网站需要付费吗郑州网站服务公司
  • 在建设工程信息网河北seo技术交流
  • 企业信息型网站有哪些可以做点赞的网站
  • wordpress 导航站主题wordpress安装完不显示
  • 网站建设的基本技术步骤遵义本地网络平台
  • 英山建设银行网站wordpress怎么看html5
  • 网站空间 支持什么程序验证wordpress
  • 郑州网站建设(智巢)谷歌推广怎么做最有效
  • 动易网站 教程桂林人论坛桂林板路
  • 做网站前端需要懂得怎么样在网上建设网站挣钱
  • 网站建设费需要摊销吗佛山网站建设企业报价
  • 网站域名不想实名认证c语言程序设计网站