From 99aa8c60282c7b8072eb35eb9ac815702f5bf586 Mon Sep 17 00:00:00 2001 From: "William R. Otte" Date: Tue, 4 Mar 2008 14:51:23 +0000 Subject: undoing accidental deletion --- ACE/apps/JAWS/server/JAWS_Concurrency.cpp | 82 +++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 ACE/apps/JAWS/server/JAWS_Concurrency.cpp (limited to 'ACE/apps/JAWS/server/JAWS_Concurrency.cpp') diff --git a/ACE/apps/JAWS/server/JAWS_Concurrency.cpp b/ACE/apps/JAWS/server/JAWS_Concurrency.cpp new file mode 100644 index 00000000000..6398469625d --- /dev/null +++ b/ACE/apps/JAWS/server/JAWS_Concurrency.cpp @@ -0,0 +1,82 @@ +// $Id$ + +#include "JAWS_Concurrency.h" + +ACE_RCSID(server, JAWS_Concurrency, "$Id$") + +JAWS_Concurrency_Base::JAWS_Concurrency_Base (void) +{ +} + +int +JAWS_Concurrency_Base::put (ACE_Message_Block *mb, ACE_Time_Value *tv) +{ + return this->putq (mb, tv); +} + +int +JAWS_Concurrency_Base::svc (void) +{ + int result = 0; + + for (;;) + { + ACE_Message_Block *mb = 0; + + // At this point we could set a timeout value so that the + // threading strategy can delete a thread if there is nothing to + // do. Carefully think how to implement it so you don't leave + // yourself with 0 threads. + + result = this->getq (mb); + if (result == -1 || mb == 0) + break; + + this->put_next (mb); + } + return 0; +} + +JAWS_Dispatch_Policy::JAWS_Dispatch_Policy (void) +{ +} + +JAWS_Dispatch_Policy::~JAWS_Dispatch_Policy (void) +{ +} + +JAWS_Dispatcher::JAWS_Dispatcher (JAWS_Dispatch_Policy *policy) + : policy_(policy) +{ +} + +JAWS_Thread_Pool_Task::JAWS_Thread_Pool_Task (long flags, + int nthreads, + int maxthreads) + : nthreads_ (nthreads), + maxthreads_ (maxthreads) +{ + if (this->activate (flags, nthreads) == -1) + ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Thread_Pool_Task::activate")); +} + +JAWS_Thread_Per_Task::JAWS_Thread_Per_Task (long flags, int maxthreads) + : flags_ (flags), + maxthreads_ (maxthreads) +{ +} + +int +JAWS_Thread_Per_Task::put (ACE_Message_Block *mb, ACE_Time_Value *tv) +{ + const int force_active = 1; + const int nthreads = 1; + + if (this->activate (this->flags_, nthreads, force_active) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Thread_Pool_Task::activate"), + -1); + + this->putq (mb, tv); + + return 0; +} -- cgit v1.2.1