
Public Member Functions | |
| ACE_Token_Queue (void) | |
| Constructor. | |
| void | remove_entry (ACE_Token_Queue_Entry *) |
| Remove a waiter from the queue. | |
| void | insert_entry (ACE_Token_Queue_Entry &entry, int requeue_position=-1) |
| Insert a waiter into the queue. | |
Public Attributes | |
| ACE_Token_Queue_Entry * | head_ |
| Head of the list of waiting threads. | |
| ACE_Token_Queue_Entry * | tail_ |
| Tail of the list of waiting threads. | |
|
|
Constructor.
Definition at line 82 of file Token.cpp. References ACE_TRACE.
|
|
||||||||||||
|
Insert a waiter into the queue.
Definition at line 127 of file Token.cpp. References ACE_Token::ACE_Token_Queue_Entry::next_. Referenced by ACE_Token::renew(), and ACE_Token::shared_acquire().
00129 {
00130 if (this->head_ == 0)
00131 {
00132 // No other threads - just add me
00133 this->head_ = &entry;
00134 this->tail_ = &entry;
00135 }
00136 else if (requeue_position == -1)
00137 {
00138 // Insert at the end of the queue.
00139 this->tail_->next_ = &entry;
00140 this->tail_ = &entry;
00141 }
00142 else if (requeue_position == 0)
00143 {
00144 // Insert at head of queue.
00145 entry.next_ = this->head_;
00146 this->head_ = &entry;
00147 }
00148 else
00149 // Insert in the middle of the queue somewhere.
00150 {
00151 // Determine where our thread should go in the queue of waiters.
00152
00153 ACE_Token::ACE_Token_Queue_Entry *insert_after = this->head_;
00154 while (requeue_position-- && insert_after->next_ != 0)
00155 insert_after = insert_after->next_;
00156
00157 entry.next_ = insert_after->next_;
00158
00159 if (entry.next_ == 0)
00160 this->tail_ = &entry;
00161
00162 insert_after->next_ = &entry;
00163 }
00164 }
|
|
|
Remove a waiter from the queue.
Definition at line 93 of file Token.cpp. References ACE_TRACE, and ACE_Token::ACE_Token_Queue_Entry::next_. Referenced by ACE_Token::renew(), and ACE_Token::shared_acquire().
00094 {
00095 ACE_TRACE ("ACE_Token::ACE_Token_Queue::remove_entry");
00096 ACE_Token_Queue_Entry *curr = 0;
00097 ACE_Token_Queue_Entry *prev = 0;
00098
00099 if (this->head_ == 0)
00100 return;
00101
00102 for (curr = this->head_;
00103 curr != 0 && curr != entry;
00104 curr = curr->next_)
00105 prev = curr;
00106
00107 if (curr == 0)
00108 // Didn't find the entry...
00109 return;
00110 else if (prev == 0)
00111 // Delete at the head.
00112 this->head_ = this->head_->next_;
00113 else
00114 // Delete in the middle.
00115 prev->next_ = curr->next_;
00116
00117 // We need to update the tail of the list if we've deleted the last
00118 // entry.
00119 if (curr->next_ == 0)
00120 this->tail_ = prev;
00121 }
|
|
|
Head of the list of waiting threads.
Definition at line 276 of file Token.h. Referenced by ACE_Token::renew(), and ACE_Token::wakeup_next_waiter(). |
|
|
Tail of the list of waiting threads.
|
1.3.6