首先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上的部分运用的更多相关文章

  1. 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 ...

  2. 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命令行 ...

  3. JMeterPluginsCMD Command Line Tool

    There is small command-line utility for generating graphs out of JTL files. It behave just like righ ...

  4. 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 ...

  5. xcode10对应的xcode command line tool编译的坑

    众所周知,xcode10新增的编译系统new build system会不支持一些老项目的编译,一般的做法是在Xcode编译配置Xcode->File->Project Settings/ ...

  6. 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, ...

  7. 怎样安装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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. myeclipse安装spring插件

    1.查看 myeclipse 中的 eclipse 对应的版本 2.下载对应eclipse的 spring 插件 首先要安装spring插件,可以到spring官网下载  地址(https://spr ...

  2. mysql拼接字符串

    CONCAT(str1,str2,...) 如:在每一列meeting_persons的现有内容之上,增加15112319字符串 UPDATE wos_hrs.meeting_logs SET mee ...

  3. type=file的inpu美化,自定义上传按钮样式

    <div class="div1"> <div class="div2">点击上传</div> <input type ...

  4. CSS之分组选择器和嵌套选择器

    分组选择器, 将一个样式应用于多个类,或者标签啥的 每个选择器用逗号隔开 <!DOCTYPE html> <html> <head> <meta charse ...

  5. VICA 架构设计

    本文记录最近完成的一个通用实时通信客户端的架构. 背景 我们公司是做税务相关的软件,有针对大客户 MIS 系统,也有针对中小客户的 SaaS 平台.这些系统虽然都是 B/S 的,但是也需要使用 Act ...

  6. 《学习之道》第八章孤军奋战or组队合作

    孤军奋战与组队合作:别再苦思冥想,拖延行为需要差别对待 对拖延我得提一个小建议,你要暂时把自己与那些会干扰你的人和事隔离开.自己到一个房间里去,或者去图书馆,这样就没什么事能让你分心了. 如果一门课让 ...

  7. 期货大赛项目|九,fileinput插件的应用

    引入JS和CSS bundles.Add(new ScriptBundle("~/bundles/fileinputJs").Include( "~/Content/ve ...

  8. labview出现系统998错误

    1.环境:xp,labview2015, 2.经过:初始状态正常,系统需要运行2016的打包的程序,运行不了,后下载了一个2016打包后的程序,点击安装,未提示异常.桌面添加了快捷方式,点击快捷方式, ...

  9. python运算符——算数运算符

    加减乘除比较简单这里不多赘述了,print(2 +-*/ 3),唯一需要注意的就是整除运算,符号是“//”,整除运算取的是整数部分,而不是四舍五入哦! print(5 / 2)    这个运行的结果是 ...

  10. c++中字符串的反转

    1.对于用char定义的字符串:使用string.h中的strrev函数 #include <iostream> #include <cstring> using namesp ...