菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
278
0

装逼的翻译,害死多少人,你同意吗?到底什么是非终止状态,终止状态

原创
05/13 14:22
阅读数 24650

http://msdn.microsoft.com/zh-cn/library/system.threading.autoresetevent.aspx

http://msdn.microsoft.com/en-us/library/system.threading.autoresetevent.aspx

很久以前对这段翻译就很不爽了,为啥一直都要把non-signaled的翻译成“非终止状态”,为啥TMD就不可以翻译成“无信号量状态”,把signaled非得叫啥“终止状态”,直接翻成“有信号量的状态”不是更好吗。

AutoResetEvent allows threads to communicate with each other by signaling. Typically, you use this class when threads need exclusive access to a resource.

A thread waits for a signal by calling WaitOne on the AutoResetEvent. If the AutoResetEvent is in the non-signaled state, the thread blocks, waiting for the thread that currently controls the resource to signal that the resource is available by calling Set.

Calling Set signals AutoResetEvent to release a waiting thread. AutoResetEvent remains signaled until a single waiting thread is released, and then automatically returns to the non-signaled state. If no threads are waiting, the state remains signaled indefinitely.

If a thread calls WaitOne while the AutoResetEvent is in the signaled state, the thread does not block. The AutoResetEvent releases the thread immediately and returns to the non-signaled state.

中文翻译

AutoResetEvent 允许线程通过发信号互相通信。 通常,当线程需要独占访问资源时使用该类。

线程通过调用 AutoResetEvent 上的 WaitOne 来等待信号。 如果 AutoResetEvent 为非终止状态,则线程会被阻止,并等待当前控制资源的线程通过调用 Set来通知资源可用。

调用 Set 向 AutoResetEvent 发信号以释放等待线程。 AutoResetEvent 将保持终止状态,直到一个正在等待的线程被释放,然后自动返回非终止状态 如果没有任何线程在等待,则状态将无限期地保持为终止状态

如果当 AutoResetEvent 为终止状态时线程调用 WaitOne,则线程不会被阻止。 AutoResetEvent 将立即释放线程并返回到非终止状态

 

其实,从英文字面意思上真的事很容易理解的东西。翻译过来之后读起来都TMD拗口。

可以尝试用我字面意思替换上面的红色字体,理解起来真的十分简单!!!

发表评论

0/200
278 点赞
0 评论
收藏
为你推荐 换一批