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

C++ pthread_rwlock_destroy函数代码示例

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

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



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

示例1: SrvTree2Free

static
VOID
SrvTree2Free(
    PLWIO_SRV_TREE_2 pTree
    )
{
    LWIO_LOG_DEBUG("Freeing tree [object:0x%x][tid:%u]",
                    pTree,
                    pTree->ulTid);

    // Cannot be in the parent since parent would have a reference.
    LWIO_ASSERT(!SrvTree2IsInParent_inlock(pTree));

    if (pTree->pMutex)
    {
        pthread_rwlock_destroy(&pTree->mutex);
        pTree->pMutex = NULL;
    }

    if (pTree->pFileCollection)
    {
        LwRtlRBTreeFree(pTree->pFileCollection);
    }

    if (pTree->hFile)
    {
        IoCloseFile(pTree->hFile);
    }

    if (pTree->pShareInfo)
    {
        SrvShareReleaseInfo(pTree->pShareInfo);
    }

    if (pTree->resource.ulResourceId)
    {
        PSRV_RESOURCE pResource = NULL;

        SrvElementsUnregisterResource(pTree->resource.ulResourceId,
                                      &pResource);
        pTree->resource.ulResourceId = 0;
    }

    // Release parent at the end
    if (pTree->pSession)
    {
        SrvSession2Release(pTree->pSession);
    }

    SrvFreeMemory(pTree);
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:51,代码来源:srvtree2.c


示例2: main

int main(void)
{
	int cnt = 0;
	int rc = 0;

	pthread_t thread;

	rc = pthread_rwlock_init(&rwlock, NULL);
	if (rc != 0) {
		printf
		    ("Test FAILED: Error at pthread_rwlock_init(), returns %d\n",
		     rc);
		return PTS_FAIL;
	}

	thread_state = 1;
	printf("main: create thread\n");
	if (pthread_create(&thread, NULL, fn_rd, NULL) != 0) {
		printf("main: failed to create thread\n");
		return PTS_UNRESOLVED;
	}

	/* If the shared data is not altered by child after 3 seconds,
	   we regard it as blocked */
	/* We expect the thread not to block */
	cnt = 0;
	do {
		sleep(1);
	} while (thread_state != 3 && cnt++ < 3);

	if (thread_state == 2) {
		printf("Test FAILED: thread blocked on read lock\n");
		exit(PTS_FAIL);
	} else if (thread_state != 3) {
		printf("main: Unexpected thread state\n");
		exit(PTS_UNRESOLVED);
	}

	if (pthread_join(thread, NULL) != 0) {
		printf("main: Error at pthread_join()\n");
		exit(PTS_UNRESOLVED);
	}

	if (pthread_rwlock_destroy(&rwlock) != 0) {
		printf("Error at pthread_rwlock_destroy()\n");
		return PTS_UNRESOLVED;
	}

	printf("Test PASSED\n");
	return PTS_PASS;
}
开发者ID:1587,项目名称:ltp,代码行数:51,代码来源:2-1.c


示例3: mas_threads_destroy

void
mas_threads_destroy( void )
{
  CTRL_PREPARE;

  pthread_attr_destroy( &ctrl.thglob.custom_attr );

  pthread_attr_destroy( &ctrl.thglob.logger_attr );
  pthread_cond_destroy( &ctrl.thglob.logger_wait_cond );
  pthread_mutex_destroy( &ctrl.thglob.logger_wait_mutex );

  pthread_attr_destroy( &ctrl.thglob.master_attr );
  pthread_attr_destroy( &ctrl.thglob.ticker_attr );
  pthread_attr_destroy( &ctrl.thglob.watcher_attr );
  CPU_FREE( ctrl.thglob.master_set );
  ctrl.thglob.master_set = NULL;

  pthread_attr_destroy( &ctrl.thglob.listener_attr );
  CPU_FREE( ctrl.thglob.listener_set );
  ctrl.thglob.listener_set = NULL;

  pthread_attr_destroy( &ctrl.thglob.transaction_attr );
  CPU_FREE( ctrl.thglob.transaction_set );
  ctrl.thglob.transaction_set = NULL;

  pthread_rwlock_destroy( &ctrl.thglob.modules_list_rwlock );
  pthread_rwlock_destroy( &ctrl.thglob.lcontrols_list_rwlock );
  pthread_rwlock_destroy( &ctrl.thglob.control_rwlock );

  pthread_mutex_destroy( &ctrl.thglob.mfp_mutex );
  pthread_mutex_destroy( &ctrl.thglob.msg_mutex );
  pthread_mutex_destroy( &ctrl.thglob.emsg_mutex );
  pthread_mutex_destroy( &ctrl.thglob.cleanup_transactions_mutex );
  pthread_mutex_destroy( &ctrl.thglob.malloc_mutex );
  pthread_mutex_destroy( &ctrl.thglob.cnttr1_mutex );
  pthread_mutex_destroy( &ctrl.thglob.cnttr2_mutex );
//pthread_mutex_destroy( &ctrl.thglob.log_mutex );
}
开发者ID:mastarink,项目名称:github-zocromas,代码行数:38,代码来源:mas_init_threads.c


示例4: bthread_timer_del

	void DownSpeed::Clear()
	{
#ifdef CszTest
        Csz::LI("[%s->%s->%d]",__FILE__,__func__,__LINE__);
#endif
		auto code= bthread_timer_del(id);
		if (code!= 0)
		{
			Csz::ErrMsg("[%s->%s->%d]->failed,calculate speed still running or einval,code=%d",__FILE__,__func__,__LINE__,code);
		}
		pthread_rwlock_destroy(&lock);
		queue.clear();
		return ;
	}
开发者ID:HelloCsz,项目名称:SocketTemplate,代码行数:14,代码来源:CszDownSpeed.cpp


示例5: sharddir_delete

void
sharddir_delete(struct sharddir **sharddp)
{
	struct sharddir *shardd;

	AN(sharddp);
	shardd = *sharddp;
	*sharddp = NULL;

	CHECK_OBJ_NOTNULL(shardd, SHARDDIR_MAGIC);
	shardcfg_delete(shardd);
	AZ(pthread_rwlock_destroy(&shardd->mtx));
	FREE_OBJ(shardd);
}
开发者ID:Dridi,项目名称:varnish-cache,代码行数:14,代码来源:shard_dir.c


示例6: NpfsFreeFCB

NTSTATUS
NpfsFreeFCB(
    PNPFS_FCB pFCB
    )
{
    NTSTATUS ntStatus = 0;

    pthread_rwlock_destroy(&pFCB->PipeListRWLock);
    LwRtlUnicodeStringFree(&pFCB->PipeName);

    NpfsFreeMemory(pFCB);

    return(ntStatus);
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:14,代码来源:fcb.c


示例7: thread_rwlock_cleanup

static apr_status_t thread_rwlock_cleanup(void *data)
{
    apr_thread_rwlock_t *rwlock = (apr_thread_rwlock_t *)data;
    apr_status_t stat;

    pthread_rwlock_unlock(rwlock->rwlock);
    stat = pthread_rwlock_destroy(rwlock->rwlock);
#ifdef PTHREAD_SETS_ERRNO
    if (stat) {
        stat = errno;
    }
#endif
    return stat;
} 
开发者ID:kheradmand,项目名称:Break,代码行数:14,代码来源:thread_rwlock.c


示例8: delete_list

void delete_list(c_list *list) {
	if(list) {
		c_node *tmp = list->head;
		while(tmp) {
			c_node *tmp2 = tmp;
			tmp = tmp2->next;
			delete_node(tmp2);
		}
		
		pthread_rwlock_destroy((list->lock));
		free(list->lock);
		free(list);
	}
}
开发者ID:richardzhangrui,项目名称:proxylab,代码行数:14,代码来源:cache.c


示例9: __attribute

/* clean up upon library unload */
void __attribute ((destructor)) memhack_exit (void)
{
	u32 i;
#if USE_DEBUG_LOG
	if (DBG_FILE_VAR) {
		fflush(DBG_FILE_VAR);
		fclose(DBG_FILE_VAR);
	}
#endif
	if (!active || !config)
		return;
	for (i = 0; config[i] != NULL; i++)
		pthread_rwlock_destroy(&config[i]->lock);
}
开发者ID:rmusser01,项目名称:ugtrain,代码行数:15,代码来源:libmemhack.c


示例10: CRYPTO_THREAD_lock_free

void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock)
{
    if (lock == NULL)
        return;

# ifdef USE_RWLOCK
    pthread_rwlock_destroy(lock);
# else
    pthread_mutex_destroy(lock);
# endif
    OPENSSL_free(lock);

    return;
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:14,代码来源:threads_pthread.c


示例11: vdir_delete

void
vdir_delete(struct vdir **vdp)
{
	struct vdir *vd;

	TAKE_OBJ_NOTNULL(vd, vdp, VDIR_MAGIC);

	AZ(vd->dir);
	free(vd->backend);
	free(vd->weight);
	AZ(pthread_rwlock_destroy(&vd->mtx));
	vbit_destroy(vd->healthy);
	FREE_OBJ(vd);
}
开发者ID:nigoroll,项目名称:varnish-cache,代码行数:14,代码来源:vdir.c


示例12: lookupRefDestruct

static void
lookupRefDestruct(lookup_ref_t *pThis)
{
	lookupStopReloader(pThis);
	pthread_mutex_destroy(&pThis->reloader_mut);
	pthread_cond_destroy(&pThis->run_reloader);
	pthread_attr_destroy(&pThis->reloader_thd_attr);

	pthread_rwlock_destroy(&pThis->rwlock);
	lookupDestruct(pThis->self);
	free(pThis->name);
	free(pThis->filename);
	free(pThis);
}
开发者ID:nirmoy,项目名称:rsyslog,代码行数:14,代码来源:lookup.c


示例13: thread_list_free

void thread_list_free(struct thread_list_t *list)
{
	struct thread_list_node_t *prev = NULL;

	pthread_rwlock_destroy(&list->lock);
	
	while (list->head)
	{
		prev = list->head;
		list->head = list->head->next;
		free(prev);
	}
	free(list);	
}
开发者ID:3upperm2n,项目名称:gpuSimulators,代码行数:14,代码来源:thread-list.c


示例14: rbt_free

/**
 * Free resources used to hold information about the tree. This
 * function does not free memory pointed to by the data pointer
 * in a node - you have to free this memory by walking thru the
 * tree or use the callback version of rbt_free for a specific
 * tree type.
 * @param rbt tree pointer
 */
void rbt_free(rbt_t *rbt, void (*callback)(void *))
{
        struct rbt_node *stack[48], *n;
        register uint8_t depth;

        rbt_wlock(rbt);

        depth = 0;
        n = rbt_node_ptr(rbt->root);

        if (n != NULL) {
                rbt_walk_push(n);

                while(depth > 0) {
                        n = rbt_node_ptr(rbt_walk_top()->_chld[RBT_NODE_SL]);

                        if (n != NULL)
                                rbt_walk_push(n);
                        else {
                        __in:
                                if (callback != NULL)
                                        callback((void *)&(rbt_walk_top()->_node));

                                n = rbt_node_ptr(rbt_walk_top()->_chld[RBT_NODE_SR]);
                                free(rbt_walk_top());

                                if (n != NULL)
                                        rbt_walk_top() = n;
                                else {
                                        if (--depth > 0)
                                                goto __in;
                                        else
                                                break;
                                }
                        }
                }
        }
        rbt_wunlock(rbt);

        rbt->root = NULL;
        rbt->size = 0;
        rbt->type = -1;

#if defined(RBT_IMPLICIT_LOCKING)
        pthread_rwlock_destroy (&rbt->lock);
#endif
        free (rbt);
        return;
}
开发者ID:GautamSatish,项目名称:openscap,代码行数:57,代码来源:rbt_common.c


示例15: TEST

TEST(pthread, pthread_rwlock_smoke) {
  pthread_rwlock_t l;
  ASSERT_EQ(0, pthread_rwlock_init(&l, NULL));

  // Single read lock
  ASSERT_EQ(0, pthread_rwlock_rdlock(&l));
  ASSERT_EQ(0, pthread_rwlock_unlock(&l));

  // Multiple read lock
  ASSERT_EQ(0, pthread_rwlock_rdlock(&l));
  ASSERT_EQ(0, pthread_rwlock_rdlock(&l));
  ASSERT_EQ(0, pthread_rwlock_unlock(&l));
  ASSERT_EQ(0, pthread_rwlock_unlock(&l));

  // Write lock
  ASSERT_EQ(0, pthread_rwlock_wrlock(&l));
  ASSERT_EQ(0, pthread_rwlock_unlock(&l));

  // Try writer lock
  ASSERT_EQ(0, pthread_rwlock_trywrlock(&l));
  ASSERT_EQ(EBUSY, pthread_rwlock_trywrlock(&l));
  ASSERT_EQ(EBUSY, pthread_rwlock_tryrdlock(&l));
  ASSERT_EQ(0, pthread_rwlock_unlock(&l));

  // Try reader lock
  ASSERT_EQ(0, pthread_rwlock_tryrdlock(&l));
  ASSERT_EQ(0, pthread_rwlock_tryrdlock(&l));
  ASSERT_EQ(EBUSY, pthread_rwlock_trywrlock(&l));
  ASSERT_EQ(0, pthread_rwlock_unlock(&l));
  ASSERT_EQ(0, pthread_rwlock_unlock(&l));

  // Try writer lock after unlock
  ASSERT_EQ(0, pthread_rwlock_wrlock(&l));
  ASSERT_EQ(0, pthread_rwlock_unlock(&l));

#ifdef __BIONIC__
  // EDEADLK in "read after write"
  ASSERT_EQ(0, pthread_rwlock_wrlock(&l));
  ASSERT_EQ(EDEADLK, pthread_rwlock_rdlock(&l));
  ASSERT_EQ(0, pthread_rwlock_unlock(&l));

  // EDEADLK in "write after write"
  ASSERT_EQ(0, pthread_rwlock_wrlock(&l));
  ASSERT_EQ(EDEADLK, pthread_rwlock_wrlock(&l));
  ASSERT_EQ(0, pthread_rwlock_unlock(&l));
#endif

  ASSERT_EQ(0, pthread_rwlock_destroy(&l));
}
开发者ID:nick0lay,项目名称:platform_bionic,代码行数:49,代码来源:pthread_test.cpp


示例16: pthread_rwlock_destroy

dcol::~dcol()
{
	myLogger.lw(INFO,"DESTRUCTOR: Cleaning up.");
	
	// Destroy timer RW mutex:
	pthread_rwlock_destroy(&timerLock);
	
	// Deallocate Memory:
	if (dataThread != NULL)
	{
		delete [] dataThread;
		dataThread = NULL;
	}
	/*
	if (paramThread != NULL)
	{
		delete [] paramThread;
		paramThread = NULL;
	}
	*/
	if (dataGood != NULL)
	{
		delete [] dataGood;
		dataGood = NULL;
	}
	/*
	if (paramGood != NULL)
	{
		delete [] paramGood;
		paramGood = NULL;
	}
	*/
	if (dcolTask != NULL)
	{
		delete [] dcolTask;
		dcolTask = NULL;
	}
	
	/*
	if (pcolTask != NULL)
	{
		delete [] pcolTask;
		pcolTask = NULL;
	}
	*/
	
	myLogger.lw(INFO,"DESTRUCTOR: DCOL TERMINATED.");
	myLogger.close();
}
开发者ID:DayStarEngineering,项目名称:CDH,代码行数:49,代码来源:DataCollector.cpp


示例17: sampler_free

void sampler_free(sampler s)
{
	size_t i;

	if(s != NULL) {
		pthread_rwlock_destroy(&s->lock);
		mem_free(s->times);

		for(i = 0; i < s->nentity; i++) 
			mem_free(s->entities[i].data);

		mem_free(s->entities);
		mem_free(s);
	}
}
开发者ID:timburks,项目名称:highland,代码行数:15,代码来源:meta_sampler.c


示例18: fskit_dir_handle_destroy

// free a directory handle
static void fskit_dir_handle_destroy( struct fskit_dir_handle* dirh ) {

   dirh->dent = NULL;

   if( dirh->path != NULL ) {
      fskit_safe_free( dirh->path );
      dirh->path = NULL;
   }

   pthread_rwlock_destroy( &dirh->lock );

   memset( dirh, 0, sizeof(struct fskit_dir_handle) );

   fskit_safe_free( dirh );
}
开发者ID:jaromil,项目名称:fskit,代码行数:16,代码来源:closedir.c


示例19: list_destroy

int list_destroy(struct list *list) {

    int ret;
    
    assert(list->root == NULL);

    ret = pthread_rwlock_destroy(list->listrwlock);
    assert(ret == 0);
    free(list->listrwlock);
    list->listrwlock = NULL;

    list->root = NULL;

    return 0;
}
开发者ID:rethab,项目名称:message-broker,代码行数:15,代码来源:list.c


示例20: kore_task_destroy

void
kore_task_destroy(struct kore_task *t)
{
	kore_debug("kore_task_destroy: %p", t);

	if (t->req != NULL) {
		t->req = NULL;
		LIST_REMOVE(t, rlist);
	}

	close(t->fds[0]);
	close(t->fds[1]);		/* This might already be closed. */

	pthread_rwlock_destroy(&(t->lock));
}
开发者ID:ebottabi,项目名称:kore,代码行数:15,代码来源:tasks.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pthread_rwlock_init函数代码示例发布时间:2022-05-30
下一篇:
C++ pthread_once函数代码示例发布时间: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