If you can do this, your threaded code will be really efficient and it won't tie up valuable mutex locks.
如果能够做到这一点,线程代码将是非常高效的,并且不会占用宝贵的互斥对象锁。
However, this kind of rhetoric has been prevalent for many years now, and yet a lot of developers are still happily writing single-threaded code.
然而,这类话语已经流行了多年,可是很多开发人员仍然乐于编写单线程代码。
You could put the calling thread to sleep for a little bit, say three seconds between each check, but then your threaded code wouldn't be optimally responsive.
在每次检查之间,可以让调用线程短暂地进入睡眠,比如睡眠三秒钟,但是因此线程代码就无法最快作出响应。
The web server takes advantage of the server's many cores to allow it to handle many simultaneous requests from the user, but each such request can often be handled by single-threaded code.
web服务器利用服务器的多个内核来同时处理来自用户的多个请求,但是每个这样的请求通常都由单线程代码处理。
For years, processor makers consistently delivered increases in clock rates and instruction-level parallelism, so that single-threaded code executed faster on newer processors with no modification.
多年来,处理器制造厂商在不断提高时钟速度和指令级并行性,因此单线程代码不需要修改就可在新的处理器上更快运行。
For years, processor makers consistently delivered increases in clock rates and instruction-level parallelism, so that single-threaded code executed faster on newer processors with no modification.
多年来,处理器制造厂商在不断提高时钟速度和指令级并行性,因此单线程代码不需要修改就可在新的处理器上更快运行。
应用推荐