[ace-users] ACE_Task and ACE_Event_Handler
Douglas C. Schmidt
schmidt at dre.vanderbilt.edu
Wed Aug 29 08:49:31 CDT 2007
Hi,
>I'm using ThreadPool (Manager) sample from chapter 16.2 of APG.
>I'm starting it as
>ThreadPool.activate(); <- I tried different settings but it did not
>help.
BTW, *always* make sure to check the return values of any methods you
call to make sure things are working properly.
>loop
>{
> ThreadPool.putq(MessageBlock);
Aha, so is this blocking the handle_timeout() call? If so, that's why
you're not getting any other timers dispatched..
>}
>
>I have to process large array on handle_timeout() so I decided to do
>it by using thread pool.
Right, but you need to make sure that you have a separate thread
running to handle timers.
>>>>> It sounds like you aren't allowing the main thread to run anymore once
>>>>> you spawn the thread pool - hence the timer signals won't get to run.
>
>Yes. This is what I'm thinking. I just needed simple and local thread
>pool implementation and I was hoping ACE_Task will do the trick. But
>it looks like ACE_Task activate() overwrites something global.
No, that's not correct. You need to make sure you are
. Activating the threads outside of handle_timeout().
. Not letting the queue fill up.
I recommend you read Chapter 6 and 7 of C++NPv2
<www.cs.wustl.edu/~schmidt/ACE/book2/> for more examples of how to use
thread pools with ACE_Task.
Thanks,
Doug
--
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Vanderbilt University WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203 NET: d.schmidt at vanderbilt.edu
More information about the Ace-users
mailing list