Threading and concurrency control vary widely with different operating systems. To make threads programming easier and portable, Ice provides a simple thread abstraction layer that allows you to write portable source code regardless of the underlying platform.
This section looks at the threading and concurrency control mechanisms in Ice for C++. It explains the threading abstractions provided by Ice: mutexes, monitors, and threads. Using these APIs allows you to make your code thread safe and to create threads of your own without having to use non-portable APIs that differ in syntax or semantics across different platforms: Ice not only provides a portable API but also guarantees that the semantics of the various functions are the same across different platforms. This makes it easier to create thread-safe applications and lets you move your code between platforms with simple recompilation.
This section assumes you are familiar with light-weight threads and concurrency control. Also see The Ice Threading Model, which provides a language-neutral introduction to the Ice threading model.
The Ice threading library provides the following thread-related abstractions:
- recursive mutexes
- a thread abstraction that allows you to create, control, and destroy threads
The synchronization primitives permit you to implement concurrency control at different levels of granularity. In addition, the thread abstraction allows you to, for example, create a separate thread that can respond to GUI or other asynchronous events. All of the threading APIs are part of the
- The C++ Mutex Class
- The C++ RecMutex Class
- The C++ Monitor Class
- The C++ Cond Class
- The C++ Thread Classes
- Priority Inversion in C++