Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_TP_Token_Guard Class Reference

A helper class that helps grabbing, releasing and waiting on tokens for a thread that tries calling handle_events (). More...

`#include <TP_Reactor.h>`

Collaboration diagram for ACE_TP_Token_Guard:

[legend]
List of all members.

## Public Methods
| ACE_TP_Token_Guard (ACE_Select_Reactor_Token &token)
| Constructor that will grab the token for us. More...
| ~ACE_TP_Token_Guard (void)
| Destructor. This will release the token if it hasnt been released till this point. More...
void | release_token (void)
| Release the token .. More...
int | is_owner (void)
| Returns whether the thread that created this object ownes the token or not. More...
int | grab_token (ACE_Time_Value *max_wait_time=0)
| A helper method that grabs the token for us, after which the thread that owns that can do some actual work. @todo: Should probably be called acquire_read_token (). More...
int | acquire_token (ACE_Time_Value *max_wait_time=0)
## Private Methods
| ACE_TP_Token_Guard (void)
## Private Attributes
ACE_Select_Reactor_Token & | token_
| The Select Reactor token. More...
int | owner_
| Flag that indicate whether the thread that created this object owns the token or not. A value of 0 indicates that this class hasnt got the token (and hence the thread) and a value of 1 vice-versa. More...

## Detailed Description

A helper class that helps grabbing, releasing and waiting on tokens for a thread that tries calling handle_events ().

In short, this class will be owned by one thread by creating on the stack. This class gives the status of the ownership of the token and manages the ownership

## Constructor & Destructor Documentation

ACE_INLINE ACE_TP_Token_Guard::ACE_TP_Token_Guard | ( | ACE_Select_Reactor_Token & | token | ) |

| Constructor that will grab the token for us.

ACE_INLINE ACE_TP_Token_Guard::~ACE_TP_Token_Guard | ( | void |  | ) |

| Destructor. This will release the token if it hasnt been released till this point.

ACE_TP_Token_Guard::ACE_TP_Token_Guard | ( | void |  | ) | `[private]`

## Member Function Documentation

int ACE_TP_Token_Guard::acquire_token | ( | ACE_Time_Value * | max_wait_time = 0 | ) |

int ACE_TP_Token_Guard::grab_token | ( | ACE_Time_Value * | max_wait_time = 0 | ) |

| A helper method that grabs the token for us, after which the thread that owns that can do some actual work. @todo: Should probably be called acquire_read_token ().

ACE_INLINE int ACE_TP_Token_Guard::is_owner | ( | void |  | ) |

| Returns whether the thread that created this object ownes the token or not.

ACE_INLINE void ACE_TP_Token_Guard::release_token | ( | void |  | ) |

| Release the token ..

## Member Data Documentation

int ACE_TP_Token_Guard::owner_`[private]`

| Flag that indicate whether the thread that created this object owns the token or not. A value of 0 indicates that this class hasnt got the token (and hence the thread) and a value of 1 vice-versa.

ACE_Select_Reactor_Token& ACE_TP_Token_Guard::token_`[private]`

| The Select Reactor token.

The documentation for this class was generated from the following files:

- TP_Reactor.h
- TP_Reactor.cpp
- TP_Reactor.i