Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / apps / JAWS / server / JAWS_Concurrency.cpp
blobeda9d75f8cdc957f972d3ae57ef132aba9e71dce
1 #include "JAWS_Concurrency.h"
3 JAWS_Concurrency_Base::JAWS_Concurrency_Base ()
7 int
8 JAWS_Concurrency_Base::put (ACE_Message_Block *mb, ACE_Time_Value *tv)
10 return this->putq (mb, tv);
13 int
14 JAWS_Concurrency_Base::svc ()
16 int result = 0;
18 for (;;)
20 ACE_Message_Block *mb = 0;
22 // At this point we could set a timeout value so that the
23 // threading strategy can delete a thread if there is nothing to
24 // do. Carefully think how to implement it so you don't leave
25 // yourself with 0 threads.
27 result = this->getq (mb);
28 if (result == -1 || mb == 0)
29 break;
31 this->put_next (mb);
33 return 0;
36 JAWS_Dispatch_Policy::JAWS_Dispatch_Policy ()
40 JAWS_Dispatch_Policy::~JAWS_Dispatch_Policy ()
44 JAWS_Dispatcher::JAWS_Dispatcher (JAWS_Dispatch_Policy *policy)
45 : policy_(policy)
49 JAWS_Thread_Pool_Task::JAWS_Thread_Pool_Task (long flags,
50 int nthreads,
51 int maxthreads)
52 : nthreads_ (nthreads),
53 maxthreads_ (maxthreads)
55 if (this->activate (flags, nthreads) == -1)
56 ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Thread_Pool_Task::activate"));
59 JAWS_Thread_Per_Task::JAWS_Thread_Per_Task (long flags, int maxthreads)
60 : flags_ (flags),
61 maxthreads_ (maxthreads)
65 int
66 JAWS_Thread_Per_Task::put (ACE_Message_Block *mb, ACE_Time_Value *tv)
68 const int force_active = 1;
69 const int nthreads = 1;
71 if (this->activate (this->flags_, nthreads, force_active) == -1)
72 ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Thread_Pool_Task::activate"),
73 -1);
75 this->putq (mb, tv);
77 return 0;