summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-01-15 16:36:20 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-01-15 16:36:20 +0000
commit98bef5411eff694cf9742caaf5ebdaa79f34110a (patch)
tree861fbb6385358064d7766b4d66b6d750001a6ec3 /ace
parente6e635b3036e35b855464e194dff5853ef242cf4 (diff)
downloadATCD-98bef5411eff694cf9742caaf5ebdaa79f34110a.tar.gz
checked a few files in for Doug
Diffstat (limited to 'ace')
-rw-r--r--ace/Thread_Manager.h25
-rw-r--r--ace/Timer_Heap.cpp2
-rw-r--r--ace/Timer_List.cpp54
3 files changed, 48 insertions, 33 deletions
diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h
index bf459052e2d..8c175825534 100644
--- a/ace/Thread_Manager.h
+++ b/ace/Thread_Manager.h
@@ -270,22 +270,23 @@ public:
ACE_ALLOC_HOOK_DECLARE;
// Declare the dynamic allocation hooks.
+protected:
+ virtual int spawn_i (ACE_THR_FUNC func,
+ void *args,
+ long flags,
+ ACE_thread_t * = 0,
+ ACE_hthread_t *t_handle = 0,
+ u_int priority = 0,
+ int grp_id = -1,
+ void *stack = 0,
+ size_t stack_size = 0,
+ ACE_Task_Base *task = 0);
+ // Create a new thread (must be called with locks held).
+
private:
int resize (size_t);
// Resize the pool of Thread_Descriptors.
- int spawn_i (ACE_THR_FUNC func,
- void *args,
- long flags,
- ACE_thread_t * = 0,
- ACE_hthread_t *t_handle = 0,
- u_int priority = 0,
- int grp_id = -1,
- void *stack = 0,
- size_t stack_size = 0,
- ACE_Task_Base *task = 0);
- // Create a new thread (must be called with locks held).
-
int find_thread (ACE_thread_t t_id);
// Locate the index of the table slot occupied by <t_id>. Returns
// -1 if <t_id> is not in the table doesn't contain <t_id>.
diff --git a/ace/Timer_Heap.cpp b/ace/Timer_Heap.cpp
index e90fb8b0306..62486736a71 100644
--- a/ace/Timer_Heap.cpp
+++ b/ace/Timer_Heap.cpp
@@ -303,7 +303,7 @@ ACE_Timer_Heap::alloc_node (void)
if (this->preallocated_nodes_ == 0)
ACE_NEW_RETURN (temp,
ACE_Timer_Node,
- -1);
+ 0);
else
{
temp = this->preallocated_nodes_freelist_;
diff --git a/ace/Timer_List.cpp b/ace/Timer_List.cpp
index deef677f0c4..02b06518f9d 100644
--- a/ace/Timer_List.cpp
+++ b/ace/Timer_List.cpp
@@ -46,6 +46,18 @@ ACE_Timer_List::is_empty (void) const
return this->head_ == 0;
}
+ACE_Timer_Node *
+ACE_Timer_List::alloc_node (void)
+{
+ return new ACE_Timer_Node;
+}
+
+void
+ACE_Timer_List::free_node (ACE_Timer_Node *node)
+{
+ delete node;
+}
+
// Returns earliest time in a non-empty list.
const ACE_Time_Value &
@@ -67,7 +79,7 @@ ACE_Timer_List::~ACE_Timer_List (void)
while (curr != 0)
{
ACE_Timer_Node *next = curr->next_;
- delete curr;
+ this->free_node (curr);
curr = next;
}
}
@@ -132,14 +144,15 @@ ACE_Timer_List::schedule (ACE_Event_Handler *handler,
if (this->is_empty () || future_time < this->earliest_time ())
{
// Place at the beginning of the list.
- ACE_NEW_RETURN (this->head_,
- ACE_Timer_Node (handler,
- arg,
- future_time,
- interval,
- this->head_,
- timer_id),
- -1);
+ ACE_Timer_Node *temp = this->alloc_node ();
+
+ // Use operator placement new.
+ this->head_ = new (temp) ACE_Timer_Node (handler,
+ arg,
+ future_time,
+ interval,
+ this->head_,
+ timer_id);
return timer_id;
}
@@ -156,14 +169,15 @@ ACE_Timer_List::schedule (ACE_Event_Handler *handler,
after = after->next_;
}
- ACE_NEW_RETURN (prev->next_,
- ACE_Timer_Node (handler,
- arg,
- future_time,
- interval,
- after,
- timer_id),
- -1);
+ ACE_Timer_Node *temp = this->alloc_node ();
+
+ // Use operator placement new.
+ prev->next_ = new (temp) ACE_Timer_Node (handler,
+ arg,
+ future_time,
+ interval,
+ after,
+ timer_id);
return timer_id;
}
}
@@ -210,7 +224,7 @@ ACE_Timer_List::cancel (int timer_id,
if (arg != 0)
*arg = curr->arg_;
- delete curr;
+ this->free_node (curr);
return 1;
}
else
@@ -239,13 +253,13 @@ ACE_Timer_List::cancel (ACE_Event_Handler *handler)
if (prev == 0)
{
this->head_ = curr->next_;
- delete curr;
+ this->free_node (curr);
curr = this->head_;
}
else
{
prev->next_ = curr->next_;
- delete curr;
+ this->free_node (curr);
curr = prev->next_;
}
}