zoukankan      html  css  js  c++  java
  • 装逼的翻译,害死多少人,你同意吗?到底什么是非终止状态,终止状态

    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拗口。

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

  • 相关阅读:
    线程池
    交互
    Java类文件的结构详细介绍
    redis
    弹幕
    约瑟夫环问题
    Redis数据类型和应用场景
    Java集合类整体结构
    JDBC详细介绍
    Mybatis万能Map
  • 原文地址:https://www.cnblogs.com/shineqiujuan/p/3281508.html
Copyright © 2011-2022 走看看