You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Wenxiu Huang <we...@gmail.com> on 2010/11/08 06:02:07 UTC
Initialization for threadpool
Hi,
I'm using TThreadPoolSever in C++. My service handler has a heavy
initialization cost.
I'm wondering if each thread in the thread pool has its own independent
initialization process or just share one?
If not share, how to optimize it?
--
From:
Wenxiu.H
Re: Initialization for threadpool
Posted by Jeff Zhang <zj...@gmail.com>.
Service handler is not thread-safe and each thread share the same
instance of handler. It is just like the servlet if you know java web
programming.
On Mon, Nov 8, 2010 at 1:02 PM, Wenxiu Huang <we...@gmail.com> wrote:
> Hi,
>
> I'm using TThreadPoolSever in C++. My service handler has a heavy
> initialization cost.
> I'm wondering if each thread in the thread pool has its own independent
> initialization process or just share one?
>
> If not share, how to optimize it?
>
> --
> From:
> Wenxiu.H
>
--
Best Regards
Jeff Zhang
Re: Initialization for threadpool
Posted by Yiming Zhang <on...@gmail.com>.
Wenxiu ,Huang
share one handler , so you may add lock to some of your data structure in
the handler.
And and I think you can got the answer simply by having a try.
On Mon, Nov 8, 2010 at 1:02 PM, Wenxiu Huang <we...@gmail.com> wrote:
> Hi,
>
> I'm using TThreadPoolSever in C++. My service handler has a heavy
> initialization cost.
> I'm wondering if each thread in the thread pool has its own independent
> initialization process or just share one?
>
> If not share, how to optimize it?
>
> --
> From:
> Wenxiu.H
>
--
Best Regards
Yiming Zhang