这个实现适合于单线程程序。
如果你有一个单线程程序,您不需要锁。
If you have a single threaded program, you don't need a lock.
如果代码是位于单线程程序中,可以预期thread_function代码将完整执行。
If this code were in a single-threaded program we'd expect the thread_function code to execute in its entirety.
这就带来了额外的缺点,多线程程序和单线程程序的竞争明显的不公平,这会使一台机器上运行多种混合程序有困难。
This has the additional disadvantage that multi-threaded applications compete unfairly with single-threaded applications, which makes running a mixture of applications difficult on a single machine.
线程是程序中的控制流程的封装。你可能已经习惯于写单线程程序,也就是,程序在它们的代码中一次只在一条路中执行。
A thread is an encapsulation of the flow of control in a program. you might be used to writing single-threaded programs - that is, programs that only execute one path through their code "at a time".
即使一个程序只包括一个在单一处理器上运行的单线程,一个同步的方法调用仍要比非同步的方法调用慢。
Even when a program contains only a single thread running on a single processor, a synchronized method call is still slower than an unsynchronized method call.
如果你在多核机器上运行单线程的应用程序,就要禁用除第一个核以外所有核的优化,这样会使应用程序运行得更快。
If you run a single-threaded application on a multi-core machine you might even make your application run faster by switching off all but your first core.
如刚刚提到的,遗留应用程序的单线程特性就是遗留系统技术限制的一个例子。
The single-threaded nature of legacy application, like that just mentioned, is an example of a technical limitation of a legacy system.
在效果上,同步的误用,会把应用程序变成单线程应用程序,从而降低吞吐率。
In effect, misuse of synchronization can turn the application into a single-threaded application, thereby decreasing throughput.
尽管如此,在交换的文档大小适中的情况下,这样的处理速率对于单线程应用程序来说仍然令人吃惊。
Even so, that rate is impressive for a single threaded application given the comparative size of the document being exchanged.
这些优化有利于所有的应用程序,包括只使用了单线程的。
These optimizations can benefit all applications, even those that are single-threaded.
根据对以上单线程模式的描述,要想保证程序界面的响应能力,关键是不能阻塞UI线程。
Because of the single thread model described above, it's vital to the responsiveness of your application's UI that you do not block the UI thread.
不要告诉我这些XUL应用程序一直以来都是单线程的!
Don't try to tell me that these XUL applications have been single-threaded all of this time!
只需指出基本的Swing应用程序本质上是单线程的。
Suffice it to say that Swing applications are essentially single-threaded out of the box.
在一个简单的单线程应用程序中,100%的Tree时间将用于main方法。
In a simple single-threaded application, 100 percent of the Tree time would be spent in the main method.
其次,尽管目前很多游戏都是单线程的,其应用程序仍可以受益于多线程。
Second, though most games are single-threaded today, gaming applications also can benefit from multithreading.
你可以改变,如果你使用的是单线程应用程序。
You can change accordingly, If you are using single threaded app.
你可以改变,如果你使用的是单线程应用程序。
You can change accordingly, If you are using single threaded app.
应用推荐