• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rw_destroy函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中rw_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ rw_destroy函数的具体用法?C++ rw_destroy怎么用?C++ rw_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了rw_destroy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: s1394_cmp_fini

static void
s1394_cmp_fini(s1394_hal_t *hal)
{
	s1394_cmp_hal_t *cmp = &hal->hal_cmp;

	rw_destroy(&cmp->cmp_ompr_rwlock);
	rw_destroy(&cmp->cmp_impr_rwlock);
}
开发者ID:andreiw,项目名称:polaris,代码行数:8,代码来源:s1394_cmp.c


示例2: zfs_freezfsvfs

static void
zfs_freezfsvfs(zfsvfs_t *zfsvfs)
{
	mutex_destroy(&zfsvfs->z_znodes_lock);
	mutex_destroy(&zfsvfs->z_online_recv_lock);
	list_destroy(&zfsvfs->z_all_znodes);
	rrw_destroy(&zfsvfs->z_teardown_lock);
	rw_destroy(&zfsvfs->z_teardown_inactive_lock);
	rw_destroy(&zfsvfs->z_fuid_lock);
	kmem_free(zfsvfs, sizeof (zfsvfs_t));
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:11,代码来源:zfs_vfsops.c


示例3: testcall

int
testcall(struct lwp *l, void *uap, register_t *retval)
{
	int i;

	mutex_init(&test_mutex, MUTEX_DEFAULT, IPL_NONE);
	rw_init(&test_rwlock);
	cv_init(&test_cv, "testcv");

	printf("test: creating threads\n");

	test_count = NTHREADS;
	test_exit = 0;

	for (i = 0; i < test_count; i++)
		kthread_create(0, KTHREAD_MPSAFE, NULL, thread1, &primes[i],
		    &test_threads[i], "thread%d", i);

	printf("test: sleeping\n");

	mutex_enter(&test_mutex);
	while (test_count != 0) {
		(void)cv_timedwait(&test_cv, &test_mutex, hz * SECONDS);
		test_exit = 1;
	}
	mutex_exit(&test_mutex);

	printf("test: finished\n");

	cv_destroy(&test_cv);
	rw_destroy(&test_rwlock);
	mutex_destroy(&test_mutex);

	return 0;
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:35,代码来源:test_rwlock1.c


示例4: mdeg_fini

void
mdeg_fini(void)
{
	/*
	 * Flip the enabled switch off to make sure that
	 * no events get dispatched while things are being
	 * torn down.
	 */
	mdeg.enabled = B_FALSE;

	/* destroy the task queue */
	taskq_destroy(mdeg.taskq);

	/*
	 * Deallocate the table of registered clients
	 */
	kmem_free(mdeg.tbl, mdeg.maxclnts * sizeof (mdeg_clnt_t));
	rw_destroy(&mdeg.rwlock);

	/*
	 * Free up the cached MDs.
	 */
	if (mdeg.md_curr)
		(void) md_fini_handle(mdeg.md_curr);

	if (mdeg.md_prev)
		(void) md_fini_handle(mdeg.md_prev);

	mutex_destroy(&mdeg.lock);
}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:30,代码来源:mdeg.c


示例5: rdsv3_sock_exit_data

void
rdsv3_sock_exit_data(struct rsock *sk)
{
	struct rdsv3_sock *rs = sk->sk_protinfo;

	RDSV3_DPRINTF4("rdsv3_sock_exit_data", "rs: %p sk: %p", rs, sk);

	ASSERT(rs != NULL);
	ASSERT(rdsv3_sk_sock_flag(sk, SOCK_DEAD));

	rs->rs_sk = NULL;

	list_destroy(&rs->rs_send_queue);
	list_destroy(&rs->rs_notify_queue);
	list_destroy(&rs->rs_recv_queue);

	rw_destroy(&rs->rs_recv_lock);
	mutex_destroy(&rs->rs_lock);

	mutex_destroy(&rs->rs_rdma_lock);
	avl_destroy(&rs->rs_rdma_keys);

	mutex_destroy(&rs->rs_conn_lock);
	mutex_destroy(&rs->rs_congested_lock);
	cv_destroy(&rs->rs_congested_cv);

	rdsv3_exit_waitqueue(sk->sk_sleep);
	kmem_free(sk->sk_sleep, sizeof (rdsv3_wait_queue_t));
	mutex_destroy(&sk->sk_lock);

	kmem_cache_free(rdsv3_alloc_cache, sk);
	RDSV3_DPRINTF4("rdsv3_sock_exit_data", "rs: %p sk: %p", rs, sk);
}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:33,代码来源:rdsv3_impl.c


示例6: taskq_destroy

void
taskq_destroy(taskq_t *tq)
{
	int t;
	int nthreads = tq->tq_nthreads;

	taskq_wait(tq);

	mutex_enter(&tq->tq_lock);

	tq->tq_flags &= ~TASKQ_ACTIVE;
	cv_broadcast(&tq->tq_dispatch_cv);

	while (tq->tq_nthreads != 0)
		cv_wait(&tq->tq_wait_cv, &tq->tq_lock);

	tq->tq_minalloc = 0;
	while (tq->tq_nalloc != 0) {
		ASSERT(tq->tq_freelist != NULL);
		task_free(tq, task_alloc(tq, KM_SLEEP));
	}

	mutex_exit(&tq->tq_lock);

	for (t = 0; t < nthreads; t++)
		(void) thr_join(tq->tq_threadlist[t], NULL, NULL);

	kmem_free(tq->tq_threadlist, nthreads * sizeof (thread_t));

	rw_destroy(&tq->tq_threadlock);

	kmem_free(tq, sizeof (taskq_t));
}
开发者ID:BjoKaSH,项目名称:mac-zfs,代码行数:33,代码来源:taskq.c


示例7: zcrypt_keystore_fini

void
zcrypt_keystore_fini(spa_t *spa)
{
	void *cookie;
	avl_tree_t *tree;
	zcrypt_keystore_node_t *node;

	if (spa->spa_keystore == NULL)
		return;

	rw_enter(&spa->spa_keystore->sk_lock, RW_WRITER);
	/*
	 * Note we don't bother with the refcnt of the keys in here
	 * because this function can't return failure so we just need to
	 * destroy everything.
	 */
	cookie = NULL;
	tree = &spa->spa_keystore->sk_dslkeys;
	while ((node = avl_destroy_nodes(tree, &cookie)) != NULL) {
		mutex_enter(&node->skn_lock);
		(void) zcrypt_keychain_fini(node->skn_keychain);
		zcrypt_key_free(node->skn_wrapkey);
		mutex_exit(&node->skn_lock);
		bzero(node, sizeof (zcrypt_keystore_node_t));
		kmem_free(node, sizeof (zcrypt_keystore_node_t));
	}
	avl_destroy(tree);

	rw_exit(&spa->spa_keystore->sk_lock);
	rw_destroy(&spa->spa_keystore->sk_lock);
	kmem_free(spa->spa_keystore, sizeof (zcrypt_keystore_t));
	spa->spa_keystore = NULL;
}
开发者ID:corbosman,项目名称:zfs-crypto,代码行数:33,代码来源:zcrypt.c


示例8: osi_VM_FlushVCache

/* Try to discard pages, in order to recycle a vcache entry.
 *
 * We also make some sanity checks:  ref count, open count, held locks.
 *
 * We also do some non-VM-related chores, such as releasing the cred pointer
 * (for AIX and Solaris) and releasing the gnode (for AIX).
 *
 * Locking:  afs_xvcache lock is held.  If it is dropped and re-acquired,
 *   *slept should be set to warn the caller.
 *
 * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it
 * is not dropped and re-acquired for any platform.  It may be that *slept is
 * therefore obsolescent.
 */
int
osi_VM_FlushVCache(struct vcache *avc, int *slept)
{
    if (avc->vrefCount != 0)
	return EBUSY;

    if (avc->opens)
	return EBUSY;

    /* if a lock is held, give up */
    if (CheckLock(&avc->lock))
	return EBUSY;

    AFS_GUNLOCK();
    pvn_vplist_dirty(AFSTOV(avc), 0, NULL, B_TRUNC | B_INVAL, CRED());
    AFS_GLOCK();

    /* Might as well make the obvious check */
    if (AFSTOV(avc)->v_pages)
	return EBUSY;		/* should be all gone still */

    rw_destroy(&avc->rwlock);
    if (avc->credp) {
	crfree(avc->credp);
	avc->credp = NULL;
    }


    return 0;
}
开发者ID:hwr,项目名称:openafs,代码行数:44,代码来源:osi_vm.c


示例9: mem_range_destroy

void
mem_range_destroy(void)
{

	if (mem_range_softc.mr_op == NULL)
		return;
	rw_destroy(&mr_lock);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:8,代码来源:memutil.c


示例10: splat_rwlock_test2

static int
splat_rwlock_test2(struct file *file, void *arg)
{
	rw_priv_t *rwp;
	taskq_t *tq;
	int i, rc = 0, tq_count = 256;

	rwp = (rw_priv_t *)kmalloc(sizeof(*rwp), GFP_KERNEL);
	if (rwp == NULL)
		return -ENOMEM;

	splat_init_rw_priv(rwp, file);

	/* Create several threads allowing tasks to race with each other */
	tq = taskq_create(SPLAT_RWLOCK_TEST_TASKQ, num_online_cpus(),
			  maxclsyspri, 50, INT_MAX, TASKQ_PREPOPULATE);
	if (tq == NULL) {
		rc = -ENOMEM;
		goto out;
	}

	/*
	 * Schedule N work items to the work queue each of which enters the
	 * writer rwlock, sleeps briefly, then exits the writer rwlock.  On a
	 * multiprocessor box these work items will be handled by all available
	 * CPUs.  The task function checks to ensure the tracked shared variable
	 * is always only incremented by one.  Additionally, the rwlock itself
	 * is instrumented such that if any two processors are in the
	 * critical region at the same time the system will panic.  If the
	 * rwlock is implemented right this will never happy, that's a pass.
	 */
	for (i = 0; i < tq_count; i++) {
		if (!taskq_dispatch(tq,splat_rwlock_test2_func,rwp,TQ_SLEEP)) {
			splat_vprint(file, SPLAT_RWLOCK_TEST2_NAME,
				     "Failed to queue task %d\n", i);
			rc = -EINVAL;
		}
	}

	taskq_wait(tq);

	if (rwp->rw_rc == tq_count) {
		splat_vprint(file, SPLAT_RWLOCK_TEST2_NAME, "%d racing threads "
			     "correctly entered/exited the rwlock %d times\n",
			     num_online_cpus(), rwp->rw_rc);
	} else {
		splat_vprint(file, SPLAT_RWLOCK_TEST2_NAME, "%d racing threads "
			     "only processed %d/%d w rwlock work items\n",
			     num_online_cpus(), rwp->rw_rc, tq_count);
		rc = -EINVAL;
	}

	taskq_destroy(tq);
	rw_destroy(&(rwp->rw_rwlock));
out:
	kfree(rwp);
	return rc;
}
开发者ID:harshada,项目名称:spl,代码行数:58,代码来源:splat-rwlock.c


示例11: zfs_znode_cache_destructor

/*ARGSUSED*/
static void
zfs_znode_cache_destructor(void *buf, void *arg)
{
    znode_t *zp = buf;

    ASSERT(!list_link_active(&zp->z_link_node));
    mutex_destroy(&zp->z_lock);
    rw_destroy(&zp->z_parent_lock);
    rw_destroy(&zp->z_name_lock);
    mutex_destroy(&zp->z_acl_lock);
    rw_destroy(&zp->z_xattr_lock);
    avl_destroy(&zp->z_range_avl);
    mutex_destroy(&zp->z_range_lock);

    ASSERT(zp->z_dirlocks == NULL);
    ASSERT(zp->z_acl_cached == NULL);
    ASSERT(zp->z_xattr_cached == NULL);
}
开发者ID:rosscameron,项目名称:zfs,代码行数:19,代码来源:zfs_znode.c


示例12: vnic_dev_fini

void
vnic_dev_fini(void)
{
	ASSERT(vnic_count == 0);

	rw_destroy(&vnic_lock);
	mod_hash_destroy_idhash(vnic_hash);
	kmem_cache_destroy(vnic_cache);
}
开发者ID:gvsurenderreddy,项目名称:illumos-gate,代码行数:9,代码来源:vnic_dev.c


示例13: kcpc_fini

static void
kcpc_fini(void)
{
	long hash;

	for (hash = 0; hash < CPC_HASH_BUCKETS; hash++)
		mutex_destroy(&kcpc_ctx_llock[hash]);
	rw_destroy(&kcpc_cpuctx_lock);
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:9,代码来源:cpc.c


示例14: ddi_intr_free

int
ddi_intr_free(ddi_intr_handle_t h)
{
	ddi_intr_handle_impl_t	*hdlp = (ddi_intr_handle_impl_t *)h;
	int			ret;

	DDI_INTR_APIDBG((CE_CONT, "ddi_intr_free: hdlp = %p\n", (void *)hdlp));

	if (hdlp == NULL)
		return (DDI_EINVAL);

	rw_enter(&hdlp->ih_rwlock, RW_WRITER);
	if (((hdlp->ih_flags & DDI_INTR_MSIX_DUP) &&
	    (hdlp->ih_state != DDI_IHDL_STATE_ADDED)) ||
	    ((hdlp->ih_state != DDI_IHDL_STATE_ALLOC) &&
	    (!(hdlp->ih_flags & DDI_INTR_MSIX_DUP)))) {
		rw_exit(&hdlp->ih_rwlock);
		return (DDI_EINVAL);
	}

	/* Set the number of interrupts to free */
	hdlp->ih_scratch1 = 1;

	ret = i_ddi_intr_ops(hdlp->ih_dip, hdlp->ih_dip,
	    DDI_INTROP_FREE, hdlp, NULL);

	rw_exit(&hdlp->ih_rwlock);
	if (ret == DDI_SUCCESS) {
		/* This would be the dup vector */
		if (hdlp->ih_flags & DDI_INTR_MSIX_DUP)
			atomic_dec_32(&hdlp->ih_main->ih_dup_cnt);
		else {
			int	n, curr_type;

			n = i_ddi_intr_get_current_nintrs(hdlp->ih_dip) - 1;
			curr_type = i_ddi_intr_get_current_type(hdlp->ih_dip);

			i_ddi_intr_set_current_nintrs(hdlp->ih_dip, n);

			if ((i_ddi_irm_supported(hdlp->ih_dip, curr_type)
			    != DDI_SUCCESS) && (n > 0))
				(void) i_ddi_irm_modify(hdlp->ih_dip, n);

			if (hdlp->ih_type & DDI_INTR_TYPE_FIXED)
				i_ddi_set_intr_handle(hdlp->ih_dip,
				    hdlp->ih_inum, NULL);

			i_ddi_intr_devi_fini(hdlp->ih_dip);
			i_ddi_free_intr_phdl(hdlp);
		}
		rw_destroy(&hdlp->ih_rwlock);
		kmem_free(hdlp, sizeof (ddi_intr_handle_impl_t));
	}

	return (ret);
}
开发者ID:bahamas10,项目名称:openzfs,代码行数:56,代码来源:ddi_intr.c


示例15: zfs_sb_free

void
zfs_sb_free(zfs_sb_t *zsb)
{
	int i;

	zfs_fuid_destroy(zsb);

	mutex_destroy(&zsb->z_znodes_lock);
	mutex_destroy(&zsb->z_lock);
	list_destroy(&zsb->z_all_znodes);
	rrw_destroy(&zsb->z_teardown_lock);
	rw_destroy(&zsb->z_teardown_inactive_lock);
	rw_destroy(&zsb->z_fuid_lock);
	for (i = 0; i != ZFS_OBJ_MTX_SZ; i++)
		mutex_destroy(&zsb->z_hold_mtx[i]);
	mutex_destroy(&zsb->z_ctldir_lock);
	avl_destroy(&zsb->z_ctldir_snaps);
	kmem_free(zsb, sizeof (zfs_sb_t));
}
开发者ID:AB17,项目名称:zfs,代码行数:19,代码来源:zfs_vfsops.c


示例16: rdsib_fini

/* Called from _fini */
void
rdsib_fini()
{
	/* Stop logging */
	rds_logging_destroy();

	cv_destroy(&rds_dpool.pool_cv);
	mutex_destroy(&rds_dpool.pool_lock);
	cv_destroy(&rds_cpool.pool_cv);
	mutex_destroy(&rds_cpool.pool_lock);

	rw_destroy(&rds_loopback_portmap_lock);

	rw_destroy(&rdsib_statep->rds_hca_lock);
	rw_destroy(&rdsib_statep->rds_sessionlock);
	kmem_free(rdsib_statep, sizeof (rds_state_t));

	rds_transport_ops = NULL;
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:20,代码来源:rdsib.c


示例17: zfs_sb_free

void
zfs_sb_free(zfs_sb_t *zsb)
{
	int i;

	zfs_fuid_destroy(zsb);

	mutex_destroy(&zsb->z_znodes_lock);
	mutex_destroy(&zsb->z_lock);
	list_destroy(&zsb->z_all_znodes);
	rrm_destroy(&zsb->z_teardown_lock);
	rw_destroy(&zsb->z_teardown_inactive_lock);
	rw_destroy(&zsb->z_fuid_lock);
	for (i = 0; i != ZFS_OBJ_MTX_SZ; i++)
		mutex_destroy(&zsb->z_hold_mtx[i]);
	vmem_free(zsb->z_hold_mtx, sizeof (kmutex_t) * ZFS_OBJ_MTX_SZ);
	zfs_mntopts_free(zsb->z_mntopts);
	kmem_free(zsb, sizeof (zfs_sb_t));
}
开发者ID:nwf,项目名称:zfs,代码行数:19,代码来源:zfs_vfsops.c


示例18: zfs_znode_cache_destructor

/*ARGSUSED*/
static void
zfs_znode_cache_destructor(void *buf, void *arg)
{
	znode_t *zp = buf;

	// ASSERT(!POINTER_IS_VALID(zp->z_zfsvfs));
	ASSERT(ZTOV(zp)->v_data == zp);
	vn_free(ZTOV(zp));
	ASSERT(!list_link_active(&zp->z_link_node));
	mutex_destroy(&zp->z_lock);
	rw_destroy(&zp->z_parent_lock);
	rw_destroy(&zp->z_name_lock);
	mutex_destroy(&zp->z_acl_lock);
	avl_destroy(&zp->z_range_avl);
	mutex_destroy(&zp->z_range_lock);

	ASSERT(zp->z_dirlocks == NULL);
	ASSERT(zp->z_acl_cached == NULL);
}
开发者ID:ElCoyote27,项目名称:zfs-fuse,代码行数:20,代码来源:zfs_znode.c


示例19: taskq_destructor

/*ARGSUSED*/
static void
taskq_destructor(void *arg, void *obj)
{
    taskq_t *tq = obj;

    mutex_destroy(&tq->tq_lock);
    rw_destroy(&tq->tq_threadlock);
    cv_destroy(&tq->tq_dispatch_cv);
    cv_destroy(&tq->tq_wait_cv);
}
开发者ID:pombredanne,项目名称:NetBSD,代码行数:11,代码来源:taskq.c


示例20: dce_stack_destroy

void
dce_stack_destroy(ip_stack_t *ipst)
{
	int i;
	for (i = 0; i < ipst->ips_dce_hashsize; i++) {
		rw_destroy(&ipst->ips_dce_hash_v4[i].dcb_lock);
		rw_destroy(&ipst->ips_dce_hash_v6[i].dcb_lock);
	}
	kmem_free(ipst->ips_dce_hash_v4,
	    ipst->ips_dce_hashsize * sizeof (dcb_t));
	ipst->ips_dce_hash_v4 = NULL;
	kmem_free(ipst->ips_dce_hash_v6,
	    ipst->ips_dce_hashsize * sizeof (dcb_t));
	ipst->ips_dce_hash_v6 = NULL;
	ipst->ips_dce_hashsize = 0;

	ASSERT(ipst->ips_dce_default->dce_refcnt == 1);
	kmem_cache_free(dce_cache, ipst->ips_dce_default);
	ipst->ips_dce_default = NULL;
}
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:20,代码来源:ip_dce.c



注:本文中的rw_destroy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rw_exit函数代码示例发布时间:2022-05-30
下一篇:
C++ rw_assert函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap