- 论坛徽章:
- 0
|
1.if((pool->threads = (pthread_t *)malloc(sizeof(pthread_t)
*num_worker_threads)) == NULL)
2./* create the individual worker threads */
for(i = 0; i != num_worker_threads; i++)
{
if( (rtn=pthread_create(&(pool->threads),NULL,
tpool_thread,(void*)pool)) != 0)
{
lprintf(log,FATAL,"pthread_create %s\n",strerror(rtn));
return NULL;
}
3./* wait for workers to exit */
for(i = 0; i < pool->num_threads; i++)
{
if((rtn = pthread_join(pool->threads,NULL)) != 0)
{
lprintf(log,FATAL,"pthread_join %d\n",rtn);
return -1;
}
}
是否有越界情况 |
|