我是xcode和iphone iOS开发的初学者,在调试xcode时,它显示了Thread1,Thread2,Thread3,Thread4这些线程的含义是什么? 以及它在调试中如何有用可以解释一下?
I'm a beginner in xcode and iphone iOS development while debugging the xcode it shows Thread1,Thread2,Thread3,Thread4 what these threads meant? and how it is useful in debugging can some explain?
最满意答案
出于调试自己的应用程序的目的,您实际上只需要担心Thread1,或者至少在开始编写并发代码之前(参见并发编程指南 )。
线程基本上是代码执行的特定路径。 Thread1是“主线程”,您的应用程序执行其基本操作的那个,所有用户界面代码等。当您开始进入更复杂的编程时,您可能会使用并发,在那里您将耗时的操作发送到后台线程/队列,以便它不会对主线程上发生的用户体验产生负面影响。
但是,问题中的线程2,3,4等是系统生成的线程,而不是您通常需要关注的线程。 只关心主线程,以及当你编写并发代码时,那些你明确添加操作的线程。
For the purposes of debugging your own app, you really only need to worry about Thread1, or at least until such point that you start writing concurrent code (see Concurrency Programming Guide).
A thread is basically a particular path of execution of code. Thread1 is the "main thread", the one where your app does its basic operations, all of the user interface code, etc. When you start getting into more sophisticated programming, you might employ concurrency, where you send time consuming operations to a background thread/queue so that it doesn't adversely affect the user experience which is happening on the main thread.
The threads 2, 3, 4, etc. in your question, though, are system generated threads and not ones you generally need to concern yourself with. Only worry about the main thread and, if and when you get into writing concurrent code, those threads to which you are explicitly adding operations.
更多推荐
发布评论