summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2004-09-03 14:53:54 +0000
committerSteve Huston <shuston@riverace.com>2004-09-03 14:53:54 +0000
commit3d3ec51987f2c2cefd685e920a1b977cce8cf6a5 (patch)
tree4c6864d980a799c5e90f72a8d75274b08cedd2ba /ace
parent7800659f0c7b3b01ee24d7243dfa76cb7657472d (diff)
downloadATCD-3d3ec51987f2c2cefd685e920a1b977cce8cf6a5.tar.gz
ChangeLogTag:Fri Sep 3 10:44:27 2004 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ace')
-rw-r--r--ace/Process_Manager.cpp54
1 files changed, 28 insertions, 26 deletions
diff --git a/ace/Process_Manager.cpp b/ace/Process_Manager.cpp
index f78334c855e..4aa30ef5c5d 100644
--- a/ace/Process_Manager.cpp
+++ b/ace/Process_Manager.cpp
@@ -190,6 +190,9 @@ ACE_Process_Manager::resize (size_t size)
{
ACE_TRACE ("ACE_Process_Manager::resize");
+ if (size <= this->max_process_table_size_)
+ return 0;
+
ACE_Process_Descriptor *temp;
ACE_NEW_RETURN (temp,
@@ -376,9 +379,7 @@ ACE_Process_Manager::handle_signal (int,
}
#else /* !ACE_WIN32 */
ACE_UNUSED_ARG (si);
- return reactor ()->notify
- (this,
- ACE_Event_Handler::READ_MASK);
+ return reactor ()->notify (this, ACE_Event_Handler::READ_MASK);
#endif /* !ACE_WIN32 */
}
@@ -440,8 +441,7 @@ ACE_Process_Manager::spawn (ACE_Process *process,
pid_t pid = process->spawn (options);
// Only include the pid in the parent's table.
- if (pid == ACE_INVALID_PID
- || pid == 0)
+ if (pid == ACE_INVALID_PID || pid == 0)
return pid;
ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex,
@@ -492,33 +492,35 @@ ACE_Process_Manager::append_proc (ACE_Process *proc)
{
ACE_TRACE ("ACE_Process_Manager::append_proc");
- // Try to resize the array to twice its existing size if we run out
- // of space...
- if (this->current_count_ >= this->max_process_table_size_
- && this->resize (this->max_process_table_size_ * 2) == -1)
- return -1;
- else
+ // Try to resize the array to twice its existing size (or the DEFAULT_SIZE,
+ // if there are no array entries) if we run out of space...
+ if (this->current_count_ >= this->max_process_table_size_)
{
- ACE_Process_Descriptor &proc_desc =
- this->process_table_[this->current_count_];
+ size_t new_size = this->max_process_table_size_ * 2;
+ if (new_size == 0)
+ new_size = ACE_Process_Manager::DEFAULT_SIZE;
+ if (this->resize (new_size) == -1)
+ return -1;
+ }
- proc_desc.process_ = proc;
- proc_desc.exit_notify_ = 0;
+ ACE_Process_Descriptor &proc_desc =
+ this->process_table_[this->current_count_];
+
+ proc_desc.process_ = proc;
+ proc_desc.exit_notify_ = 0;
#if defined (ACE_WIN32)
- // If we have a Reactor, then we're supposed to reap Processes
- // automagically. Get a handle to this new Process and tell the
- // Reactor we're interested in <handling_input> on it.
-
- ACE_Reactor *r = this->reactor ();
- if (r != 0)
- r->register_handler (this,
- proc->gethandle ());
+ // If we have a Reactor, then we're supposed to reap Processes
+ // automagically. Get a handle to this new Process and tell the
+ // Reactor we're interested in <handling_input> on it.
+
+ ACE_Reactor *r = this->reactor ();
+ if (r != 0)
+ r->register_handler (this, proc->gethandle ());
#endif /* ACE_WIN32 */
- this->current_count_++;
- return 0;
- }
+ this->current_count_++;
+ return 0;
}
// Insert a process into the pool (checks for duplicates and doesn't