#include <stlsoft/synch/checkout_token.hpp>
For example, consider that you have a class X whose resources are to be accessible to multiple threads, defined as follows:
class X { public: typedef std::queue<int> queue_type; public: void lock(); void unlock(); public: que };
Rather than relying on the good actions of the user, we can instead bind the locking of X's resources with access to its queue, using checkout_token, as follows:
Public Types | |
Member Types | |
typedef CT | accessed_class_type |
The type whose resources are to be protected. | |
typedef MT | accessed_member_type |
typedef checkout_token< CT, MT > | class_type |
The current instantation of the type. | |
Public Member Functions | |
Construction | |
checkout_token (accessed_class_type &ac, accessed_member_type am) | |
Locks. | |
checkout_token (class_type const &rhs) | |
Cop. | |
Accessors | |
accessed_member_type | member () |
typedef CT accessed_class_type |
The type whose resources are to be protected.
typedef checkout_token<CT, MT> class_type |
The current instantation of the type.
checkout_token | ( | accessed_class_type & | ac, | |
accessed_member_type | am | |||
) | [inline] |
Locks.
checkout_token | ( | class_type const & | rhs | ) | [inline] |
Cop.