This instance is used for all messages that are sent into the partition, making members of this class thread safe and providing the opportunity to cache required resources.
这个实例被用于发送到该分区中的所有消息,使这个类的成员线程安全并提供缓存必要资源的机会。
Making a class thread safe requires additional care during the implementation and testing of the class.
使一个类线程安全需要在实现和测试该类时非常小心。
A class that is not thread-safe can often be used safely in a multithreaded program as long as you ensure that instances of that class used by one thread are not used by other threads.
非线程安全类通常可以安全地在多线程程序中使用,只要您能确保一个线程所用的类的实例不被其它线程使用。
Consider a thread-safe container class - a data structure that guarantees thread safety to its clients.
可以考虑使用一个线程安全容器类—一个保证用户操作线程安全的数据结构。
Sometimes, it is very difficult to make a class thread-safe without compromising its functionality, ease of use, or performance.
有时,要在不影响类的功能、易用性或性能的情况下使类成为线程安全的是很困难的。
Once the class has been resolved, the original code location is modified in a thread-safe way to access the static field's address directly because that address is then known.
类一旦被解析,就会以一种线程安全的方式修改原始代码位置以便直接访问静态字段的地址,因为此时已获知该地址。
The DataMapRepository class presented previously and its base class LinkedHashMap are not thread-safe.
之前介绍过的datamaprepository类及其基类LinkedHashMap都不是线程安全的。
To ensure that your implementation is thread-safe, a class that implements this interface should use either the synchronized keyword on the methods or synchronized blocks within the methods.
为了确保实现是线程安全的,实现该接口的类应该在方法上使用synchronized关键字,或者在方法内部使用同步锁。
Note that all the methods, even get(), need to be synchronized for the class to be thread-safe, to ensure that no updates are lost, and that all threads see the most recent value of the counter.
注意所有方法,甚至需要同步get(),使类成为线程安全的类,从而确保没有任何更新信息丢失,所有线程都看到计数器的最新值。
Instead of double-checked locking, use the Initialize-on-demand Holder Class idiom, which provides lazy initialization, is thread-safe, and is faster and less confusing than double-checked locking.
不使用双重检查锁定,而使用Initialize - on - demandHolderClassidiom,它提供了迟缓初始化,是线程安全的,而且比双重检查锁定更快且没那么混乱。
The in-memory representation of a schema is defined as the schema class, which is immutable and therefore thread-safe.
模式的内存中表示被定义为schema类,该类是恒定的,因此也是线程安全的。
It is often the easiest way to render a stateful class thread-safe, or to encapsulate non-thread-safe classes so that they can safely be used in multithreaded environments.
它常常是把有状态类描绘成线程安全的,或者封装非线程安全类以使它们能够在多线程环境中安全地使用的最容易的方式。
Listing 1 shows a non-thread-safe number range class.
清单1显示了一个非线程安全的数值范围类。
It may be easier to manage the use of a non-thread-safe class than to try and make the class thread-safe.
管理非线程安全类的使用比试图使类成为线程安全的要更容易些。
Any access to the data repository is made through a thread-safe wrapper class named RepositoryWrapper.
对数据存储库的所有访问都是通过一个名为RepositoryWrapper的线程安全类实现的。
An effective technique for creating a fully thread-safe class is to merge the synchronization class into the resource class.
创建完全线程安全类的有效技术是将同步类合并到资源类中。
A class whose members are protected from such interruptions is called thread-safe.
其成员不受这类中断影响的类叫做线程安全类。
For size and performance reasons, MFC objects are not thread-safe at the object level, only at the class level.
由于大小和效能因素,MFC物件在物件层级上不是安全执行绪,只有在类别层级上才是。
For size and performance reasons, MFC objects are not thread-safe at the object level, only at the class level.
由于大小和效能因素,MFC物件在物件层级上不是安全执行绪,只有在类别层级上才是。
应用推荐