本文整理汇总了C++中pthread_spin_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ pthread_spin_destroy函数的具体用法?C++ pthread_spin_destroy怎么用?C++ pthread_spin_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pthread_spin_destroy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: unvme_session_delete
/**
* Delete a session and its associated queues.
* @param ses session
*/
static void unvme_session_delete(unvme_session_t* ses)
{
if (ses->id > 0) {
pthread_spin_lock(&ses->iomem.lock);
if (ses->iomem.size) {
int i;
for (i = 0; i < ses->iomem.count; i++) {
(void) vfio_dma_free(ses->iomem.map[i]);
}
ses->iomem.size = ses->iomem.count = 0;
free(ses->iomem.map);
}
pthread_spin_unlock(&ses->iomem.lock);
pthread_spin_destroy(&ses->iomem.lock);
}
if (ses == ses->next) {
DEBUG_FN("%x: adminq", unvme_dev.vfiodev->pci);
unvme_adminq_delete(ses->queues);
} else {
DEBUG_FN("%x: q=%d-%d", unvme_dev.vfiodev->pci, ses->id,
ses->id + ses->qcount -1);
while (--ses->qcount >= 0) {
unvme_queue_t* ioq = &ses->queues[ses->qcount];
if (ioq->ses) unvme_ioq_delete(ioq);
}
}
LIST_DEL(unvme_dev.ses, ses);
free(ses);
}
开发者ID:MicronSSD,项目名称:unvme,代码行数:34,代码来源:unvme_core.c
示例2: cleanup_context
void cleanup_context(struct tur_checker_context *ct)
{
pthread_mutex_destroy(&ct->lock);
pthread_cond_destroy(&ct->active);
pthread_spin_destroy(&ct->hldr_lock);
free(ct);
}
开发者ID:krisman,项目名称:multipath-tools,代码行数:7,代码来源:tur.c
示例3: main
int main()
{
pthread_spinlock_t spinlock;
struct sigaction act;
/* Set up child thread to handle SIGALRM */
act.sa_flags = 0;
act.sa_handler = sig_handler;
sigfillset(&act.sa_mask);
sigaction(SIGALRM, &act, 0);
printf("main: attemp to lock an un-initialized spin lock\n");
printf("main: Send SIGALRM to me after 5 secs\n");
alarm(5);
/* Attempt to lock an uninitialized spinlock */
rc = pthread_spin_lock(&spinlock);
/* If we get here, call sig_handler() to check the return code of
* pthread_spin_lock() */
sig_handler();
/* Unlock spinlock */
pthread_spin_unlock(&spinlock);
/* Destroy spinlock */
pthread_spin_destroy(&spinlock);
return PTS_PASS;
}
开发者ID:alexjohn1362,项目名称:rose,代码行数:31,代码来源:pthread_spin_lock.3-2.c
示例4: xwork_fini
int
xwork_fini (struct xwork *xwork, int stop)
{
int i = 0;
int ret = 0;
void *tret = 0;
pthread_mutex_lock (&xwork->mutex);
{
xwork->stop = (xwork->stop || stop);
pthread_cond_broadcast (&xwork->cond);
}
pthread_mutex_unlock (&xwork->mutex);
for (i = 0; i < xwork->count; i++) {
pthread_join (xwork->cthreads[i], &tret);
tdbg ("CThread id %ld returned %p\n",
xwork->cthreads[i], tret);
}
if (debug) {
assert (xwork->rootjob->refcnt == 1);
dirjob_ret (xwork->rootjob, 0);
}
if (stats)
pthread_spin_destroy(&stats_lock);
return ret;
}
开发者ID:2510,项目名称:glusterfs,代码行数:30,代码来源:gcrawler.c
示例5: do_test
static int
do_test (void)
{
pthread_spinlock_t s;
if (pthread_spin_init (&s, PTHREAD_PROCESS_PRIVATE) != 0)
{
puts ("spin_init failed");
return 1;
}
if (pthread_spin_lock (&s) != 0)
{
puts ("spin_lock failed");
return 1;
}
if (pthread_spin_unlock (&s) != 0)
{
puts ("spin_unlock failed");
return 1;
}
if (pthread_spin_destroy (&s) != 0)
{
puts ("spin_destroy failed");
return 1;
}
return 0;
}
开发者ID:riscv,项目名称:riscv-glibc,代码行数:31,代码来源:tst-spin1.c
示例6: main
int main()
{
pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE);
lockandunlock();
pthread_spin_destroy(&lock);
}
开发者ID:rchatsiri,项目名称:techniquecpp,代码行数:8,代码来源:mutex_lock_race.c
示例7: PADclose
PADclose()
{
while (!ev_fifo.empty())
ev_fifo.pop();
mutex_WasInit = false;
pthread_spin_destroy(&mutex_KeyEvent);
_PADclose();
}
开发者ID:KitoHo,项目名称:pcsx2,代码行数:8,代码来源:onepad.cpp
示例8: VOGL_ASSERT
spinlock::~spinlock()
{
#ifdef VOGL_BUILD_DEBUG
VOGL_ASSERT(!m_in_lock);
#endif
pthread_spin_destroy(&m_spinlock);
}
开发者ID:Daft-Freak,项目名称:vogl,代码行数:8,代码来源:vogl_threading_pthreads.cpp
示例9: pthread_spin_destroy
Internal::~Internal(){
#ifdef INTERNAL_USE_SPINLOCKS
pthread_spin_destroy(&_spin);
#else
pthread_mutex_destroy(&_mutex);
pthread_cond_destroy(&_cond);
#endif
}
开发者ID:thacdtd,项目名称:PGLCM,代码行数:8,代码来源:InternalBank.hpp
示例10: init_pipe
int init_pipe(struct pipe* p, int n_dst, int q_depth, int buf_sz)
{
int free_bufs = n_dst * q_depth;
struct pipe_elem* msg_all = (struct pipe_elem*)malloc(
free_bufs * (sizeof(msg_all[0]) + buf_sz));
void* buf_ptr;
int def_dst_n, i;
// allocate bufs
if (!msg_all)
return -1;
p->priv = (void*)msg_all;
// initialize src
if (init_queue(&p->src, free_bufs))
goto free_buf;
// initialize dst
def_dst_n = sizeof(p->_dst) / sizeof(p->_dst[0]);
p->dst = n_dst < def_dst_n ? &p->_dst[0] :
(struct queue*)malloc(n_dst * sizeof(p->dst[0]));
if (!p->dst)
goto free_src;
for (i = 0; i < n_dst; i++) {
if (init_queue(&p->dst[i], q_depth))
goto free_dst;
}
// init spinlock
if (pthread_spin_init(&p->lock, PTHREAD_PROCESS_PRIVATE))
goto free_dst;
// push buffers onto src
buf_ptr = (void*)&msg_all[free_bufs];
for (i = 0; i < free_bufs; i++) {
msg_all[i].buf = buf_ptr;
msg_all[i].seq = 0;
msg_all[i].ref_cnt = 0;
buf_ptr += buf_sz;
assert(!enqueue(&p->src, &msg_all[i]));
}
p->n_dst = n_dst;
return 0;
free_dst :
for (i--; i >= 0; i--)
close_queue(&p->dst[i]);
free_src :
close_queue(&p->src);
free_buf :
free(msg_all);
destroy_lock :
pthread_spin_destroy(&p->lock);
return -1;
}
开发者ID:allskyee,项目名称:v4l2_camera_xdisplay,代码行数:58,代码来源:pipe.c
示例11: pthread_spin_destroy
HawkSpinLock::~HawkSpinLock()
{
if (m_pSpinLock)
{
pthread_spin_destroy((pthread_spinlock_t*)m_pSpinLock);
HawkFree(m_pSpinLock);
m_pSpinLock = 0;
}
}
开发者ID:SleepingBearZ,项目名称:hawkproject,代码行数:9,代码来源:HawkSpinLock.cpp
示例12: dirjob_free
void
dirjob_free (struct dirjob *job)
{
assert (list_empty (&job->list));
pthread_spin_destroy (&job->lock);
free (job->dirname);
free (job);
}
开发者ID:HongweiBi,项目名称:glusterfs,代码行数:9,代码来源:gcrawler.c
示例13: thread_context_destroy
void thread_context_destroy(struct netsniff_ng_thread_context * thread_ctx)
{
assert(thread_ctx);
pthread_attr_destroy(&thread_ctx->thread_attr);
pthread_mutex_destroy(&thread_ctx->wait_mutex);
pthread_cond_destroy(&thread_ctx->wait_cond);
pthread_spin_destroy(&thread_ctx->config_lock);
}
开发者ID:eroullit,项目名称:net-toolbox,代码行数:9,代码来源:thread.c
示例14: spinlock_destroy
bool spinlock_destroy(spinlock_t *lock)
{
const int err = pthread_spin_destroy(lock);
if (err) {
error("spinlock error: %s", errno_error(err));
return false;
}
return true;
}
开发者ID:Cyber-Forensic,项目名称:haka,代码行数:9,代码来源:thread.c
示例15: nk_port_destroy
void nk_port_destroy(nk_port *port) {
if (!port) {
return;
}
assert(nk_msg_port_empty(&port->msgs));
assert(nk_schob_runq_empty(&port->thds));
pthread_spin_destroy(&port->lock);
nk_freelist_free(&port->host->port_freelist, port);
}
开发者ID:cfallin,项目名称:nk,代码行数:9,代码来源:msg.c
示例16: _starpu_spin_destroy
int _starpu_spin_destroy(starpu_spinlock_t *lock)
{
#ifdef HAVE_PTHREAD_SPIN_LOCK
return pthread_spin_destroy(&lock->lock);
#else
/* we don't do anything */
return 0;
#endif
}
开发者ID:alucas,项目名称:StarPU,代码行数:9,代码来源:starpu_spinlock.c
示例17: counter_destroy
void counter_destroy(Counter *counter)
{
#ifdef HAVE_PTHREAD_SPINLOCK_T
pthread_spin_destroy(&counter->lock);
#else
mutex_destroy(counter->lock);
#endif
gw_free(counter);
}
开发者ID:armic,项目名称:erpts,代码行数:9,代码来源:counter.c
示例18: core_lock_destroy
void core_lock_destroy(struct core_lock *self)
{
#if defined(CORE_LOCK_USE_COMPARE_AND_SWAP)
self->lock = CORE_LOCK_UNLOCKED;
#elif defined(CORE_LOCK_USE_SPIN_LOCK)
pthread_spin_destroy(&self->lock);
#elif defined(CORE_LOCK_USE_MUTEX)
pthread_mutex_destroy(&self->lock);
#endif
}
开发者ID:gkthiruvathukal,项目名称:biosal,代码行数:10,代码来源:lock.c
示例19: tree_fini
/**
* Remove resources for the tree.
*
* @param root root of the tree
*/
void tree_fini(struct bst_node ** root)
{
/* TODO: Free any global variables you used for the BST */
pthread_spin_destroy(&lock_cg);
if (root != NULL)
free(root);
}
开发者ID:maxfalk,项目名称:OSM,代码行数:15,代码来源:bst_v2.c
示例20: PMR_counter_destroy_lock
void PMR_counter_destroy_lock(counter_t *counter)
{
#ifndef DISABLE_PTHREADS
#ifdef NOSPINLOCKS
pthread_mutex_destroy(&counter->lock);
#else
pthread_spin_destroy(&counter->lock);
#endif
#endif
}
开发者ID:AmiArnab,项目名称:Elemental,代码行数:10,代码来源:counter.c
注:本文中的pthread_spin_destroy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论