int ACE_Message_Block::release_i (ACE_Lock *lock) { ACE_TRACE ("ACE_Message_Block::release_i"); // Free up all the continuation messages. if (this->cont_) { ACE_Message_Block *mb = this->cont_; ACE_Message_Block *tmp = 0; do { tmp = mb; mb = mb->cont_; tmp->cont_ = 0; ACE_Data_Block *db = tmp->data_block (); if (tmp->release_i (lock) != 0) { ACE_Allocator *allocator = db->data_block_allocator (); ACE_DES_FREE (db, allocator->free, ACE_Data_Block); } } while (mb); this->cont_ = 0; } int result = 0; if (ACE_BIT_DISABLED (this->flags_, ACE_Message_Block::DONT_DELETE) && this->data_block ()) { if (this->data_block ()->release_no_delete (lock) == 0) result = 1; this->data_block_ = 0; } // We will now commit suicide: this object *must* have come from the // allocator given. if (this->message_block_allocator_ == 0) delete this; else { ACE_Allocator *allocator = this->message_block_allocator_; ACE_DES_FREE (this, allocator->free, ACE_Message_Block); } return result; }
/*static*/ void TAO_Queued_Data::release (TAO_Queued_Data *qd) { //// TODO ACE_Message_Block::release (qd->msg_block_); if (qd->allocator_) { ACE_DES_FREE (qd, qd->allocator_->free, TAO_Queued_Data); return; } // @todo: Need to be removed at some point of time! if (TAO_debug_level == 4) { // This debug is for testing purposes! TAOLIB_DEBUG ((LM_DEBUG, "TAO (%P|%t) - Queued_Data[%d]::release\n", "Using global pool for releasing\n")); } delete qd; }
int ACE_Activation_Queue::enqueue (ACE_Method_Request *mr, ACE_Time_Value *tv) { ACE_Message_Block *mb = 0; // We pass sizeof (*mr) here so that flow control will work // correctly. Since we also pass <mr> note that no unnecessary // memory is actually allocated -- just the size field is set. ACE_NEW_MALLOC_RETURN (mb, static_cast<ACE_Message_Block *> (this->allocator_->malloc (sizeof (ACE_Message_Block))), ACE_Message_Block (sizeof (*mr), // size ACE_Message_Block::MB_DATA, // type 0, // cont (char *) mr, // data 0, // allocator 0, // locking strategy mr->priority (), // priority ACE_Time_Value::zero, // execution time ACE_Time_Value::max_time, // absolute time of deadline this->data_block_allocator_, // data_block allocator this->allocator_), // message_block allocator -1); // Enqueue in priority order. int const result = this->queue_->enqueue_prio (mb, tv); // Free ACE_Message_Block if enqueue_prio failed. if (result == -1) ACE_DES_FREE (mb, this->allocator_->free, ACE_Message_Block); return result; }
void TAO_Buffer_Allocator<handler_type, alloc_type>::release (handler_type *ptr) { ACE_DES_FREE (ptr, allocator_->free, handler_type); }
ACE_Message_Block * ACE_Message_Block::release (void) { ACE_TRACE ("ACE_Message_Block::release"); // We want to hold the data block in a temporary variable because we // invoked "delete this;" at some point, so using this->data_block_ // could be a bad idea. ACE_Data_Block *tmp = this->data_block (); // This flag is set to 1 when we have to destroy the data_block int destroy_dblock = 0; ACE_Lock *lock = 0; // Do we have a valid data block if (this->data_block ()) { // Grab the lock that belongs to my data block lock = this->data_block ()->locking_strategy (); // if we have a lock if (lock != 0) { // One guard for all ACE_GUARD_RETURN (ACE_Lock, ace_mon, *lock, 0); // Call non-guarded release with <lock> destroy_dblock = this->release_i (lock); } // This is the case when we have a valid data block but no lock else // Call non-guarded release with no lock destroy_dblock = this->release_i (0); } else // This is the case when we don't even have a valid data block destroy_dblock = this->release_i (0); if (destroy_dblock != 0) { ACE_Allocator *allocator = tmp->data_block_allocator (); ACE_DES_FREE (tmp, allocator->free, ACE_Data_Block); } return 0; }
void TransportCustomizedElement::release_element(bool dropped_by_transport) { DBG_ENTRY_LVL("TransportCustomizedElement", "release_element", 6); if (orig_) { orig_->decision_made(dropped_by_transport); } if (allocator_) { ACE_DES_FREE(this, allocator_->free, TransportCustomizedElement); } else { delete this; } }
ACE_Data_Block * ACE_Data_Block::release (ACE_Lock *lock) { ACE_TRACE ("ACE_Data_Block::release"); ACE_Allocator *allocator = this->data_block_allocator_; ACE_Data_Block *result = this->release_no_delete (lock); // We must delete this outside the scope of the locking_strategy_ // since otherwise we'd be trying to "release" through a deleted // pointer! if (result == 0) ACE_DES_FREE (this, allocator->free, ACE_Data_Block); return result; }
void OpenDDS::DCPS::TransportSendControlElement::release_element(bool dropped_by_transport) { ACE_UNUSED_ARG(dropped_by_transport); DBG_ENTRY_LVL("TransportSendControlElement","release_element",6); if (this->was_dropped()) { this->listener_->control_dropped(this->msg_, dropped_by_transport); } else { this->listener_->control_delivered(this->msg_); } if (allocator_) { ACE_DES_FREE(this, allocator_->free, TransportSendControlElement); } }
void TAO_Reply_Dispatcher::intrusive_remove_ref (TAO_Reply_Dispatcher* rd) { if (rd != 0) { long tmp = --rd->refcnt_; if (tmp <= 0) { if (rd->allocator_) { ACE_DES_FREE (rd, rd->allocator_->free, TAO_Reply_Dispatcher); } else { delete rd; } } } }