NSRunLoop 在mac command line tool上的部分运用
首先RunLoop相关博客参考这篇https://blog.csdn.net/lengshengren/article/details/12905627。
最近开发了一个mac上的命令行工具,我在主线程没有任何代码运行,而是开辟了三个queue去执行各自逻辑,导致执行下面代码时,即使我的三个queue全部运行完了,命令行仍旧没有结束掉。
while (condition)
{
// waiting for new data
if ([[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]])
{
// process current data
}
}
后来查看RunLoop详细运用时,发现正是因为我的主线程没有执行任何代码,导致没有正确返回,改成这样定时返回而不是之前的有代码执行才返回就没问题了。
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate: [NSDate dateWithTimeIntervalSinceNow:1.0]];
NSRunLoop 在mac command line tool上的部分运用的更多相关文章
- How to Use Android ADB Command Line Tool
Android Debug Bridge (adb) is a tool that lets you manage the state of an emulator instance or Andro ...
- Cordova 3.0 Plugin 安装 及"git" command line tool is not installed
根据http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface Windows命令行 ...
- JMeterPluginsCMD Command Line Tool
There is small command-line utility for generating graphs out of JTL files. It behave just like righ ...
- Cookies with curl the command line tool
w https://curl.haxx.se/docs/http-cookies.html curl has a full cookie "engine" built in. If ...
- xcode10对应的xcode command line tool编译的坑
众所周知,xcode10新增的编译系统new build system会不支持一些老项目的编译,一般的做法是在Xcode编译配置Xcode->File->Project Settings/ ...
- Building Xcode iOS projects and creating *.ipa file from the command line
For our development process of iOS applications, we are using Jenkins set up on the Mac Mini Server, ...
- 怎样安装Command Line Tools in OS x Mavericks&Yosemite(Without xcode)--转载
How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode) Mac users who pre ...
- 18 Command Line Tools to Monitor Linux Performance
By Ravi Saive Under: Linux Commands, Monitoring Tools On: December 26, 2013 http://www.tecmint.com/c ...
- cURL POST command line on WINDOWS RESTful service
26down votefavorite 7 My problem: Running windows 7 and using the executable command line tool to cu ...
随机推荐
- RabbitMQ的Java API编程
1.创建Maven工程,pom.xml引入依赖: <dependency> <groupId>com.rabbitmq</groupId> <artifact ...
- linux命令进阶
Though unconsciously,peple are indeed moving towards their destination.Slow as the progress seen fro ...
- Windows Internals 笔记——进程
1.一般将进程定义成一个正在运行的程序的一个实例,由以下两部分构成: 一个内核对象,操作系统用它来管理进程,内核对象也是系统保存进程统计信息的地方. 一个地址空间,其中包含所有可执行文件或DLL模块的 ...
- beta冲刺1/7
目录 摘要 团队部分 个人部分 摘要 队名:小白吃 组长博客:hjj 作业博客:beta冲刺(1/7) 团队部分 后敬甲(组长) 过去两天完成了哪些任务 团队完成测试答辩 整理博客 复习接口 接下来的 ...
- NumPy的思考……
问题: 为什么第一次输出矩阵形式的数据,第二次输出list形式的数据? 详见代码: a = np.array([[1, 2], [3, 4]]) print(a) print('ndim :', a. ...
- c++中字符串的反转
1.对于用char定义的字符串:使用string.h中的strrev函数 #include <iostream> #include <cstring> using namesp ...
- base和this的用法
[意义] this:指当前类,this调用当前类的属性,方法,包括构造函数的方法,继承本类的构造函数 base:指当前类的父类,可调用父类的非私有属性,方法,继承父类的构造函数括号里的参数 [用处] ...
- KaliLinuxNetHunter教程实施刷机解锁Bootloader
KaliLinuxNetHunter教程实施刷机解锁Bootloader 当用户将前面的工作都准备完成后,即可开始刷机.其中,整个刷机过程分为三个步骤,分别是解锁Bootloader.刷入第三方Rec ...
- 使用python处理地理数据:Geopandas
说句实话处理地理数据使用python还是比较麻烦的
- 容器加載Web工程的Web.xml文件介紹
转 容器加載Web工程的Web.xml文件介紹 [-] 这篇文章主要是综合网上关于webxml的一些介绍希望对大家有所帮助也欢迎大家一起讨论 ---题记 一 Webxml详解 一 ...