它产生一个新的进程和一个主执行线程。
It creates a new process and its primary thread. The new process executes the specified executable file.
这个方法总是在主ui线程上被执行,因此对于修改UI这是一个很好的选择。
This method will always be executed on the main UI thread, so it is ideal for modifying the UI.
为了避免冒险,您必须在不同的线程上执行任务,或者至少不在主ui线程上执行。
To avoid tempting fate, you must perform tasks like these on a different thread, or at least not on the main UI thread.
事实上,衍生线程中的代码甚至不能与主ui线程执行的代码位于同一个文件中。
In fact, the code in the spawned thread cannot even be in the same file as the code that is executed by the main UI thread.
如此,addStock将在一个背景线程上执行,而不是在主UI 线程上。
Thus, addStock will execute on a background thread, not on the main UI thread.
因为线程调度程序真的等同于“执行a,接着执行b,然后执行c,等等”的指令,所以要在主函数中创建一个完全并行的情况也不困难。
Since the thread scheduler really amounts to instructions to "do a, then do B, then do c, etc." it was not difficult to create an entirely parallel case in a main function.
它与多线程执行和这些线程都不怎么安全地从主方法叫什么?
How it relates to multiple threads of execution and how those threads are not safe to be called from the main method?
它与多线程执行和这些线程都不怎么安全地从主方法叫什么?
How it relates to multiple threads of execution and how those threads are not safe to be called from the main method?
应用推荐