• 4053阅读
  • 2回复

[提问]All functions in this class are reentrant.这句话什么意思 [复制链接]

上一主题 下一主题
离线ingenious
 

只看楼主 倒序阅读 楼主  发表于: 2015-10-03
All functions in this class are reentrant.这句话什么意思
离线yanwuyue

只看该作者 1楼 发表于: 2015-10-06
谷歌翻译:此类中的所有功能都是可重入

都是虚函数吧
离线kenierlee

只看该作者 2楼 发表于: 2015-10-09
Throughout the documentation, the terms reentrant and thread-safe are used to mark classes and functions to indicate how they can be used in multithread applications:

A thread-safe function can be called simultaneously from multiple threads, even when the invocations use shared data, because all references to the shared data are serialized.
A reentrant function can also be called simultaneously from multiple threads, but only if each invocation uses its own data.
Hence, a thread-safe function is always reentrant, but a reentrant function is not always thread-safe.

By extension, a class is said to be reentrant if its member functions can be called safely from multiple threads, as long as each thread uses a different instance of the class. The class is thread-safe if its member functions can be called safely from multiple threads, even if all the threads use the same instance of the class.

Note: Qt classes are only documented as thread-safe if they are intended to be used by multiple threads. If a function is not marked as thread-safe or reentrant, it should not be used from different threads. If a class is not marked as thread-safe or reentrant then a specific instance of that class should not be accessed from different threads.
快速回复
限100 字节
 
上一个 下一个