本文整理汇总了C++中pool_init函数的典型用法代码示例。如果您正苦于以下问题:C++ pool_init函数的具体用法?C++ pool_init怎么用?C++ pool_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pool_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mbinit
/*
* Initialize the mbuf allocator.
*/
void
mbinit(void)
{
int i;
#if DIAGNOSTIC
if (mclsizes[0] != MCLBYTES)
panic("mbinit: the smallest cluster size != MCLBYTES");
if (mclsizes[nitems(mclsizes) - 1] != MAXMCLBYTES)
panic("mbinit: the largest cluster size != MAXMCLBYTES");
#endif
pool_init(&mbpool, MSIZE, 0, 0, 0, "mbufpl", NULL);
pool_setipl(&mbpool, IPL_NET);
pool_set_constraints(&mbpool, &kp_dma_contig);
pool_setlowat(&mbpool, mblowat);
pool_init(&mtagpool, PACKET_TAG_MAXSIZE + sizeof(struct m_tag),
0, 0, 0, "mtagpl", NULL);
pool_setipl(&mtagpool, IPL_NET);
for (i = 0; i < nitems(mclsizes); i++) {
snprintf(mclnames[i], sizeof(mclnames[0]), "mcl%dk",
mclsizes[i] >> 10);
pool_init(&mclpools[i], mclsizes[i], 0, 0, 0,
mclnames[i], NULL);
pool_setipl(&mclpools[i], IPL_NET);
pool_set_constraints(&mclpools[i], &kp_dma_contig);
pool_setlowat(&mclpools[i], mcllowat);
}
nmbclust_update();
}
示例2: dmoverioattach
/*
* dmoverioattach:
*
* Pseudo-device attach routine.
*/
void
dmoverioattach(int count)
{
pool_init(&dmio_state_pool, sizeof(struct dmio_state),
0, 0, 0, "dmiostate", NULL, IPL_SOFTCLOCK);
pool_init(&dmio_usrreq_state_pool, sizeof(struct dmio_usrreq_state),
0, 0, 0, "dmiourstate", NULL, IPL_SOFTCLOCK);
}
示例3: time_init
/*
* Initialize timekeeping.
*/
void
time_init(void)
{
pool_init(&ptimer_pool, sizeof(struct ptimer), 0, 0, 0, "ptimerpl",
&pool_allocator_nointr, IPL_NONE);
pool_init(&ptimers_pool, sizeof(struct ptimers), 0, 0, 0, "ptimerspl",
&pool_allocator_nointr, IPL_NONE);
}
示例4: ext2fs_init
int
ext2fs_init(struct vfsconf *vfsp)
{
pool_init(&ext2fs_inode_pool, sizeof(struct inode), 0, 0, 0,
"ext2inopl", &pool_allocator_nointr);
pool_init(&ext2fs_dinode_pool, sizeof(struct ext2fs_dinode), 0, 0, 0,
"ext2dinopl", &pool_allocator_nointr);
return (ufs_init(vfsp));
}
示例5: ext2fs_init
void
ext2fs_init(void)
{
pool_init(&ext2fs_inode_pool, sizeof(struct inode), 0, 0, 0,
"ext2fsinopl", &pool_allocator_nointr, IPL_NONE);
pool_init(&ext2fs_dinode_pool, sizeof(struct ext2fs_dinode), 0, 0, 0,
"ext2dinopl", &pool_allocator_nointr, IPL_NONE);
ufs_init();
}
示例6: ext2fs_init
int
ext2fs_init(struct vfsconf *vfsp)
{
pool_init(&ext2fs_inode_pool, sizeof(struct inode), 0, 0, PR_WAITOK,
"ext2inopl", NULL);
pool_init(&ext2fs_dinode_pool, sizeof(struct ext2fs_dinode), 0, 0,
PR_WAITOK, "ext2dinopl", NULL);
return (ufs_init(vfsp));
}
示例7: udf_init
int
udf_init(struct vfsconf *foo)
{
pool_init(&udf_trans_pool, MAXNAMLEN * sizeof(unicode_t), 0, 0,
PR_WAITOK, "udftrpl", NULL);
pool_init(&unode_pool, sizeof(struct unode), 0, 0,
PR_WAITOK, "udfndpl", NULL);
pool_init(&udf_ds_pool, sizeof(struct udf_dirstream), 0, 0,
PR_WAITOK, "udfdspl", NULL);
return (0);
}
示例8: udf_init
int
udf_init(struct vfsconf *foo)
{
pool_init(&udf_trans_pool, MAXNAMLEN * sizeof(unicode_t), 0, 0, 0,
"udftrpl", &pool_allocator_nointr);
pool_init(&unode_pool, sizeof(struct unode), 0, 0, 0,
"udfndpl", &pool_allocator_nointr);
pool_init(&udf_ds_pool, sizeof(struct udf_dirstream), 0, 0, 0,
"udfdspl", &pool_allocator_nointr);
return (0);
}
示例9: nfs_node_init
/*
* Reinitialize inode hash table.
*/
void
nfs_node_init(void)
{
pool_init(&nfs_node_pool, sizeof(struct nfsnode), 0, 0, 0, "nfsnodepl",
&pool_allocator_nointr, IPL_NONE);
pool_init(&nfs_vattr_pool, sizeof(struct vattr), 0, 0, 0, "nfsvapl",
&pool_allocator_nointr, IPL_NONE);
if (workqueue_create(&nfs_sillyworkq, "nfssilly", nfs_sillyworker,
NULL, PRI_NONE, IPL_NONE, 0) != 0) {
panic("nfs_node_init");
}
}
示例10: task_dispatcher_init
int task_dispatcher_init(struct task_dispatcher_t** ptd, uint32_t nthreads)
{
LOGI("Starting task dispatcher with %d threads", nthreads);
struct task_dispatcher_t* td = malloc(sizeof(struct task_dispatcher_t));
memset(td, 0, sizeof(struct task_dispatcher_t));
td->nthreads = nthreads;
td->running = 1;
if (pool_init(&td->tasks, MAX_TASKS, sizeof(struct task_t)) != 0)
{
return -1;
}
pthread_mutex_init(&td->event_lock, NULL);
pthread_cond_init(&td->event, NULL);
pthread_mutexattr_init(&td->lock_attr);
pthread_mutexattr_settype(&td->lock_attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&td->lock, &td->lock_attr);
uint32_t i = 0;
for (i = 0; i < td->nthreads; ++i)
{
pthread_create(&td->threads[i], NULL, working_thread, td);
}
(*ptd) = td;
return 0;
}
示例11: main
int main(int argc,char **argv)
{
/*线程池中最多3个活动线程*/
pool_init(3);
int *workingnum=(int *)malloc(sizeof(int)*10);
/*连续向线程池中投入10个任务*/
int i;
for(i=0;i<10;i++)
{
workingnum[i]=i;
pool_add_worker(myprocess,&workingnum[i]);
}
/*等待所有任务完成*/
sleep(5);
/*销毁线程池*/
pool_destroy();
free(workingnum);
return 0;
}
示例12: main
int main(void)
{
go = false;
finish = false;
pool_init(&pool);
for(int i = 0;i < NUM_PRODUCER;i++)
{
pthread_create(&producer[i], NULL, &producer_runner, (void*)(size_t)i);
}
for(int i = 0;i < NUM_CONSUMER;i++)
{
pthread_create(&producer[i], NULL, &thread_runner, (void*)(size_t)i);
}
go = true;
sleep(1);
finish = true;
for(int i = 0;i < NUM_PRODUCER;i++)
{
pthread_join(producer[i], NULL);
}
for(int i = 0;i < NUM_CONSUMER;i++)
{
pthread_join(consumer[i], NULL);
}
return 0;
}
示例13: _ensure_pool_cleanup_gracefully_handles_cleaned_up_pool
static void _ensure_pool_cleanup_gracefully_handles_cleaned_up_pool( void )
{
pool_t pool;
pool_init( &pool, 4, 16, allocator_default( ) );
pool_cleanup( &pool );
pool_cleanup( &pool );
}
示例14: _ensure_pool_is_empty_gracefully_handles_cleaned_up_pool
static void _ensure_pool_is_empty_gracefully_handles_cleaned_up_pool( void )
{
pool_t pool;
pool_init( &pool, 4, 1, allocator_default( ) );
pool_cleanup( &pool );
TEST_REQUIRE( pool_is_empty( &pool ) != 0 );
}
示例15: nfs4_acls_init
int nfs4_acls_init(void)
{
LogDebug(COMPONENT_NFS_V4_ACL, "Initialize NFSv4 ACLs");
LogDebug(COMPONENT_NFS_V4_ACL,
"sizeof(fsal_ace_t)=%zu, sizeof(fsal_acl_t)=%zu",
sizeof(fsal_ace_t), sizeof(fsal_acl_t));
/* Initialize memory pool of ACLs. */
fsal_acl_pool =
pool_init(NULL, sizeof(fsal_acl_t), pool_basic_substrate, NULL,
NULL, NULL);
/* Create hash table. */
fsal_acl_hash = hashtable_init(&fsal_acl_hash_config);
if (!fsal_acl_hash) {
LogCrit(COMPONENT_NFS_V4_ACL,
"ERROR creating hash table for NFSv4 ACLs");
return NFS_V4_ACL_INTERNAL_ERROR;
}
nfs4_acls_test();
return NFS_V4_ACL_SUCCESS;
}