本文整理汇总了C++中DESTROYLOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ DESTROYLOCK函数的具体用法?C++ DESTROYLOCK怎么用?C++ DESTROYLOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DESTROYLOCK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isc_stats_detach
void
isc_stats_detach(isc_stats_t **statsp) {
isc_stats_t *stats;
REQUIRE(statsp != NULL && ISC_STATS_VALID(*statsp));
stats = *statsp;
*statsp = NULL;
LOCK(&stats->lock);
stats->references--;
UNLOCK(&stats->lock);
if (stats->references == 0) {
isc_mem_put(stats->mctx, stats->copiedcounters,
sizeof(isc_stat_t) * stats->ncounters);
isc_mem_put(stats->mctx, stats->counters,
sizeof(isc_stat_t) * stats->ncounters);
DESTROYLOCK(&stats->lock);
#ifdef ISC_RWLOCK_USEATOMIC
isc_rwlock_destroy(&stats->counterlock);
#endif
isc_mem_putanddetach(&stats->mctx, stats, sizeof(*stats));
}
}
示例2: dlopen_dlz_destroy
/*
* Called when bind is shutting down
*/
static void
dlopen_dlz_destroy(void *driverarg, void *dbdata) {
dlopen_data_t *cd = (dlopen_data_t *) dbdata;
isc_mem_t *mctx;
UNUSED(driverarg);
if (cd->dlz_destroy) {
MAYBE_LOCK(cd);
cd->dlz_destroy(cd->dbdata);
MAYBE_UNLOCK(cd);
}
if (cd->dl_path)
isc_mem_free(cd->mctx, cd->dl_path);
if (cd->dlzname)
isc_mem_free(cd->mctx, cd->dlzname);
if (cd->dl_handle)
FreeLibrary(cd->dl_handle);
DESTROYLOCK(&cd->lock);
mctx = cd->mctx;
isc_mem_put(mctx, cd, sizeof(*cd));
isc_mem_destroy(&mctx);
}
示例3: destroy
static void
destroy(isc_hash_t **hctxp) {
isc_hash_t *hctx;
isc_mem_t *mctx;
unsigned char canary0[4], canary1[4];
REQUIRE(hctxp != NULL && *hctxp != NULL);
hctx = *hctxp;
*hctxp = NULL;
LOCK(&hctx->lock);
isc_refcount_destroy(&hctx->refcnt);
mctx = hctx->mctx;
#ifdef BIND9
if (hctx->entropy != NULL)
isc_entropy_detach(&hctx->entropy);
#endif
if (hctx->rndvector != NULL)
isc_mem_put(mctx, hctx->rndvector, hctx->vectorlen);
UNLOCK(&hctx->lock);
DESTROYLOCK(&hctx->lock);
memcpy(canary0, hctx + 1, sizeof(canary0));
memset(hctx, 0, sizeof(isc_hash_t));
memcpy(canary1, hctx + 1, sizeof(canary1));
INSIST(memcmp(canary0, canary1, sizeof(canary0)) == 0);
isc_mem_put(mctx, hctx, sizeof(isc_hash_t));
isc_mem_detach(&mctx);
}
示例4: ns_interface_destroy
static void
ns_interface_destroy(ns_interface_t *ifp) {
isc_mem_t *mctx = ifp->mgr->mctx;
int disp;
REQUIRE(NS_INTERFACE_VALID(ifp));
ns_interface_shutdown(ifp);
for (disp = 0; disp < ifp->nudpdispatch; disp++)
if (ifp->udpdispatch[disp] != NULL) {
dns_dispatch_changeattributes(ifp->udpdispatch[disp], 0,
DNS_DISPATCHATTR_NOLISTEN);
dns_dispatch_detach(&(ifp->udpdispatch[disp]));
}
if (ifp->tcpsocket != NULL)
isc_socket_detach(&ifp->tcpsocket);
DESTROYLOCK(&ifp->lock);
ns_interfacemgr_detach(&ifp->mgr);
ifp->magic = 0;
isc_mem_put(mctx, ifp, sizeof(*ifp));
}
示例5: task_finished
static void
task_finished(isc__task_t *task) {
isc__taskmgr_t *manager = task->manager;
REQUIRE(EMPTY(task->events));
REQUIRE(EMPTY(task->on_shutdown));
REQUIRE(task->references == 0);
REQUIRE(task->state == task_state_done);
XTRACE("task_finished");
LOCK(&manager->lock);
UNLINK(manager->tasks, task, link);
#ifdef USE_WORKER_THREADS
if (FINISHED(manager)) {
/*
* All tasks have completed and the
* task manager is exiting. Wake up
* any idle worker threads so they
* can exit.
*/
BROADCAST(&manager->work_available);
}
#endif /* USE_WORKER_THREADS */
UNLOCK(&manager->lock);
DESTROYLOCK(&task->lock);
task->common.impmagic = 0;
task->common.magic = 0;
isc_mem_put(manager->mctx, task, sizeof(*task));
}
示例6: destroy
static inline void
destroy(dns_ssutable_t *table) {
isc_mem_t *mctx;
REQUIRE(VALID_SSUTABLE(table));
mctx = table->mctx;
while (!ISC_LIST_EMPTY(table->rules)) {
dns_ssurule_t *rule = ISC_LIST_HEAD(table->rules);
if (rule->identity != NULL) {
dns_name_free(rule->identity, mctx);
isc_mem_put(mctx, rule->identity, sizeof(dns_name_t));
}
if (rule->name != NULL) {
dns_name_free(rule->name, mctx);
isc_mem_put(mctx, rule->name, sizeof(dns_name_t));
}
if (rule->types != NULL)
isc_mem_put(mctx, rule->types,
rule->ntypes * sizeof(dns_rdatatype_t));
ISC_LIST_UNLINK(table->rules, rule, link);
rule->magic = 0;
isc_mem_put(mctx, rule, sizeof(dns_ssurule_t));
}
DESTROYLOCK(&table->lock);
table->magic = 0;
isc_mem_putanddetach(&table->mctx, table, sizeof(dns_ssutable_t));
}
示例7: destroy
static void
destroy(isc_hash_t **hctxp) {
isc_hash_t *hctx;
isc_mem_t *mctx;
REQUIRE(hctxp != NULL && *hctxp != NULL);
hctx = *hctxp;
*hctxp = NULL;
LOCK(&hctx->lock);
isc_refcount_destroy(&hctx->refcnt);
mctx = hctx->mctx;
if (hctx->entropy != NULL)
isc_entropy_detach(&hctx->entropy);
if (hctx->rndvector != NULL)
isc_mem_put(mctx, hctx->rndvector, hctx->vectorlen);
UNLOCK(&hctx->lock);
DESTROYLOCK(&hctx->lock);
memset(hctx, 0, sizeof(isc_hash_t));
isc_mem_put(mctx, hctx, sizeof(isc_hash_t));
isc_mem_detach(&mctx);
}
示例8: destroy
static void
destroy(isc__timer_t *timer) {
isc__timermgr_t *manager = timer->manager;
/*
* The caller must ensure it is safe to destroy the timer.
*/
LOCK(&manager->lock);
(void)isc_task_purgerange(timer->task,
timer,
ISC_TIMEREVENT_FIRSTEVENT,
ISC_TIMEREVENT_LASTEVENT,
NULL);
deschedule(timer);
UNLINK(manager->timers, timer, link);
UNLOCK(&manager->lock);
isc_task_detach(&timer->task);
DESTROYLOCK(&timer->lock);
timer->common.impmagic = 0;
timer->common.magic = 0;
isc_mem_put(manager->mctx, timer, sizeof(*timer));
}
示例9: settings_set_free
/**
* Free dynamically allocated memory associated with given set of settings.
* @pre *set is initialized set of settings, set != NULL && *set != NULL
* @post *set == NULL
*/
void
settings_set_free(settings_set_t **set) {
isc_mem_t *mctx = NULL;
setting_t *s = NULL;
if (set == NULL || *set == NULL)
return;
if ((*set)->mctx != NULL) {
mctx = (*set)->mctx;
if ((*set)->lock != NULL) {
DESTROYLOCK((*set)->lock);
SAFE_MEM_PUT_PTR(mctx, (*set)->lock);
}
for (s = (*set)->first_setting; s->name != NULL; s++) {
if (s->is_dynamic)
isc_mem_free(mctx, s->value.value_char);
}
if ((*set)->first_setting != NULL)
isc_mem_free(mctx, (*set)->first_setting);
isc_mem_free(mctx, (*set)->name);
isc_mem_free(mctx, *set);
isc_mem_detach(&mctx);
}
*set = NULL;
}
示例10: dns_keytable_detach
void
dns_keytable_detach(dns_keytable_t **keytablep) {
isc_boolean_t destroy = ISC_FALSE;
dns_keytable_t *keytable;
/*
* Detach *keytablep from its keytable.
*/
REQUIRE(keytablep != NULL && VALID_KEYTABLE(*keytablep));
keytable = *keytablep;
RWLOCK(&keytable->rwlock, isc_rwlocktype_write);
INSIST(keytable->references > 0);
keytable->references--;
LOCK(&keytable->lock);
if (keytable->references == 0 && keytable->active_nodes == 0)
destroy = ISC_TRUE;
UNLOCK(&keytable->lock);
RWUNLOCK(&keytable->rwlock, isc_rwlocktype_write);
if (destroy) {
dns_rbt_destroy(&keytable->table);
isc_rwlock_destroy(&keytable->rwlock);
DESTROYLOCK(&keytable->lock);
keytable->magic = 0;
isc_mem_putanddetach(&keytable->mctx,
keytable, sizeof(*keytable));
}
*keytablep = NULL;
}
示例11: isc_quota_destroy
void
isc_quota_destroy(isc_quota_t *quota) {
INSIST(quota->used == 0);
quota->max = -1;
quota->used = -1;
quota->soft = ISC_FALSE;
DESTROYLOCK("a->lock);
}
示例12: isc_quota_destroy
void
isc_quota_destroy(isc_quota_t *quota) {
INSIST(quota->used == 0);
quota->max = 0;
quota->used = 0;
quota->soft = 0;
DESTROYLOCK("a->lock);
}
示例13: isc__app_ctxfinish
ISC_APPFUNC_SCOPE void
isc__app_ctxfinish(isc_appctx_t *ctx0) {
isc__appctx_t *ctx = (isc__appctx_t *)ctx0;
REQUIRE(VALID_APPCTX(ctx));
DESTROYLOCK(&ctx->lock);
}
示例14: isc__task_create
ISC_TASKFUNC_SCOPE isc_result_t
isc__task_create(isc_taskmgr_t *manager0, unsigned int quantum,
isc_task_t **taskp)
{
isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
isc__task_t *task;
isc_boolean_t exiting;
isc_result_t result;
REQUIRE(VALID_MANAGER(manager));
REQUIRE(taskp != NULL && *taskp == NULL);
task = isc_mem_get(manager->mctx, sizeof(*task));
if (task == NULL)
return (ISC_R_NOMEMORY);
XTRACE("isc_task_create");
task->manager = manager;
result = isc_mutex_init(&task->lock);
if (result != ISC_R_SUCCESS) {
isc_mem_put(manager->mctx, task, sizeof(*task));
return (result);
}
task->state = task_state_idle;
task->references = 1;
INIT_LIST(task->events);
INIT_LIST(task->on_shutdown);
task->quantum = quantum;
task->flags = 0;
task->now = 0;
memset(task->name, 0, sizeof(task->name));
task->tag = NULL;
INIT_LINK(task, link);
INIT_LINK(task, ready_link);
INIT_LINK(task, ready_priority_link);
exiting = ISC_FALSE;
LOCK(&manager->lock);
if (!manager->exiting) {
if (task->quantum == 0)
task->quantum = manager->default_quantum;
APPEND(manager->tasks, task, link);
} else
exiting = ISC_TRUE;
UNLOCK(&manager->lock);
if (exiting) {
DESTROYLOCK(&task->lock);
isc_mem_put(manager->mctx, task, sizeof(*task));
return (ISC_R_SHUTTINGDOWN);
}
task->common.methods = (isc_taskmethods_t *)&taskmethods;
task->common.magic = ISCAPI_TASK_MAGIC;
task->common.impmagic = TASK_MAGIC;
*taskp = (isc_task_t *)task;
return (ISC_R_SUCCESS);
}
示例15: ns_interfacemgr_destroy
static void
ns_interfacemgr_destroy(ns_interfacemgr_t *mgr) {
REQUIRE(NS_INTERFACEMGR_VALID(mgr));
dns_aclenv_destroy(&mgr->aclenv);
ns_listenlist_detach(&mgr->listenon4);
ns_listenlist_detach(&mgr->listenon6);
clearlistenon(mgr);
DESTROYLOCK(&mgr->lock);
mgr->magic = 0;
isc_mem_putanddetach(&mgr->mctx, mgr, sizeof(*mgr));
}