- pthread_attr_init(&attr_);
- pthread_attr_setstacksize(&attr_, 128<<10);
-
- for (int i = 0; i < sz; i++) {
- pthread_t t;
- VERIFY(pthread_create(&t, &attr_, do_worker, (void *)this) ==0);
- th_.push_back(t);
- }
+ for (int i=0; i<nthreads_; i++)
+ th_.emplace_back(&ThrPool::do_worker, this);