本文整理汇总了C++中pj_lock_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ pj_lock_destroy函数的具体用法?C++ pj_lock_destroy怎么用?C++ pj_lock_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pj_lock_destroy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PJ_DEF
/*
* pj_ioqueue_destroy()
*
* Destroy ioqueue.
*/
PJ_DEF(pj_status_t) pj_ioqueue_destroy(pj_ioqueue_t *ioqueue)
{
pj_ioqueue_key_t *key;
PJ_ASSERT_RETURN(ioqueue, PJ_EINVAL);
PJ_ASSERT_RETURN(ioqueue->epfd > 0, PJ_EINVALIDOP);
pj_lock_acquire(ioqueue->lock);
os_close(ioqueue->epfd);
ioqueue->epfd = 0;
#if PJ_IOQUEUE_HAS_SAFE_UNREG
/* Destroy reference counters */
key = ioqueue->active_list.next;
while (key != &ioqueue->active_list) {
pj_lock_destroy(key->lock);
key = key->next;
}
key = ioqueue->closing_list.next;
while (key != &ioqueue->closing_list) {
pj_lock_destroy(key->lock);
key = key->next;
}
key = ioqueue->free_list.next;
while (key != &ioqueue->free_list) {
pj_lock_destroy(key->lock);
key = key->next;
}
pj_mutex_destroy(ioqueue->ref_cnt_mutex);
#endif
return ioqueue_destroy(ioqueue);
}
示例2: destroy
/*
* Destroy.
*/
static void destroy(pj_turn_sock *turn_sock)
{
if (turn_sock->lock) {
pj_lock_acquire(turn_sock->lock);
}
if (turn_sock->sess) {
pj_turn_session_set_user_data(turn_sock->sess, NULL);
pj_turn_session_shutdown(turn_sock->sess);
turn_sock->sess = NULL;
}
if (turn_sock->active_sock) {
PJ_LOG(4, ("turn_session.c", "!!! TURN DEALLOCATE !!! in destroy() close connection"));
pj_activesock_set_user_data(turn_sock->active_sock, NULL);
pj_activesock_close(turn_sock->active_sock);
turn_sock->active_sock = NULL;
}
if (turn_sock->lock) {
pj_lock_release(turn_sock->lock);
pj_lock_destroy(turn_sock->lock);
turn_sock->lock = NULL;
}
if (turn_sock->pool) {
pj_pool_t *pool = turn_sock->pool;
turn_sock->pool = NULL;
pj_pool_release(pool);
}
}
示例3: destroy
/*
* Destroy.
*/
static void destroy(pj_turn_sock *turn_sock)
{
if (turn_sock->lock) {
pj_lock_acquire(turn_sock->lock);
}
if (turn_sock->sess) {
pj_turn_session_set_user_data(turn_sock->sess, NULL);
pj_turn_session_shutdown(turn_sock->sess);
turn_sock->sess = NULL;
}
if (turn_sock->active_sock) {
pj_activesock_close(turn_sock->active_sock);
turn_sock->active_sock = NULL;
}
if (turn_sock->lock) {
pj_lock_release(turn_sock->lock);
pj_lock_destroy(turn_sock->lock);
turn_sock->lock = NULL;
}
if (turn_sock->pool) {
pj_pool_t *pool = turn_sock->pool;
turn_sock->pool = NULL;
pj_pool_release(pool);
}
}
示例4: PJ_DEF
/*
* Start the clock.
*/
PJ_DEF(pj_status_t) pjmedia_clock_start(pjmedia_clock *clock)
{
pj_timestamp now;
pj_status_t status;
PJ_ASSERT_RETURN(clock != NULL, PJ_EINVAL);
if (clock->running)
return PJ_SUCCESS;
status = pj_get_timestamp(&now);
if (status != PJ_SUCCESS)
return status;
clock->next_tick.u64 = now.u64 + clock->interval.u64;
clock->running = PJ_TRUE;
clock->quitting = PJ_FALSE;
if ((clock->options & PJMEDIA_CLOCK_NO_ASYNC) == 0 && !clock->thread) {
status = pj_thread_create(clock->pool, "clock", &clock_thread, clock,
0, 0, &clock->thread);
if (status != PJ_SUCCESS) {
pj_lock_destroy(clock->lock);
return status;
}
}
return PJ_SUCCESS;
}
示例5: PJ_DEF
/*
* Destroy the master port, and optionally destroy the u_port and
* d_port ports.
*/
PJ_DEF(pj_status_t) pjmedia_master_port_destroy(pjmedia_master_port *m,
pj_bool_t destroy_ports)
{
PJ_ASSERT_RETURN(m, PJ_EINVAL);
if (m->clock) {
pjmedia_clock_destroy(m->clock);
m->clock = NULL;
}
if (m->u_port && destroy_ports) {
pjmedia_port_destroy(m->u_port);
m->u_port = NULL;
}
if (m->d_port && destroy_ports) {
pjmedia_port_destroy(m->d_port);
m->d_port = NULL;
}
if (m->lock) {
pj_lock_destroy(m->lock);
m->lock = NULL;
}
return PJ_SUCCESS;
}
示例6: lis_destroy
/* This callback is called by transport manager to destroy listener */
static pj_status_t lis_destroy(pjsip_tpfactory *factory)
{
struct tls_listener *listener = (struct tls_listener *)factory;
if (listener->is_registered) {
pjsip_tpmgr_unregister_tpfactory(listener->tpmgr, &listener->factory);
listener->is_registered = PJ_FALSE;
}
if (listener->ssock) {
pj_ssl_sock_close(listener->ssock);
listener->ssock = NULL;
}
if (listener->factory.lock) {
pj_lock_destroy(listener->factory.lock);
listener->factory.lock = NULL;
}
if (listener->factory.pool) {
pj_pool_t *pool = listener->factory.pool;
PJ_LOG(4,(listener->factory.obj_name, "SIP TLS listener destroyed"));
listener->factory.pool = NULL;
pj_pool_release(pool);
}
return PJ_SUCCESS;
}
示例7: PJ_DEF
PJ_DEF(pj_status_t) pjsip_regc_destroy(pjsip_regc *regc)
{
PJ_ASSERT_RETURN(regc, PJ_EINVAL);
pj_lock_acquire(regc->lock);
if (regc->has_tsx || pj_atomic_get(regc->busy_ctr) != 0) {
regc->_delete_flag = 1;
regc->cb = NULL;
pj_lock_release(regc->lock);
} else {
pjsip_tpselector_dec_ref(®c->tp_sel);
if (regc->last_transport) {
pjsip_transport_dec_ref(regc->last_transport);
regc->last_transport = NULL;
}
if (regc->timer.id != 0) {
pjsip_endpt_cancel_timer(regc->endpt, ®c->timer);
regc->timer.id = 0;
}
pj_atomic_destroy(regc->busy_ctr);
pj_lock_release(regc->lock);
pj_lock_destroy(regc->lock);
regc->lock = NULL;
pjsip_endpt_release_pool(regc->endpt, regc->pool);
}
return PJ_SUCCESS;
}
示例8: transport_destroy
static pj_status_t transport_destroy (pjmedia_transport *tp)
{
transport_srtp *srtp = (transport_srtp *) tp;
pj_status_t status;
unsigned i;
PJ_ASSERT_RETURN(tp, PJ_EINVAL);
/* Close keying */
for (i=0; i < srtp->keying_cnt; i++)
pjmedia_transport_close(srtp->keying[i]);
/* Close member if configured */
if (srtp->setting.close_member_tp && srtp->member_tp) {
pjmedia_transport_close(srtp->member_tp);
}
status = pjmedia_transport_srtp_stop(tp);
/* In case mutex is being acquired by other thread */
pj_lock_acquire(srtp->mutex);
pj_lock_release(srtp->mutex);
pj_lock_destroy(srtp->mutex);
pj_pool_release(srtp->pool);
return status;
}
示例9: PJ_DEF
PJ_DEF(void) pj_timer_heap_destroy( pj_timer_heap_t *ht )
{
if (ht->lock && ht->auto_delete_lock) {
pj_lock_destroy(ht->lock);
ht->lock = NULL;
}
}
示例10: PJ_DEF
PJ_DEF(void) pj_caching_pool_destroy( pj_caching_pool *cp )
{
int i;
pj_pool_t *pool;
PJ_CHECK_STACK();
/* Delete all pool in free list */
for (i=0; i < PJ_CACHING_POOL_ARRAY_SIZE; ++i) {
pj_pool_t *pool = (pj_pool_t*) cp->free_list[i].next;
pj_pool_t *next;
for (; pool != (void*)&cp->free_list[i]; pool = next) {
next = pool->next;
pj_list_erase(pool);
pj_pool_destroy_int(pool);
}
}
/* Delete all pools in used list */
pool = (pj_pool_t*) cp->used_list.next;
while (pool != (pj_pool_t*) &cp->used_list) {
pj_pool_t *next = pool->next;
pj_list_erase(pool);
PJ_LOG(4,(pool->obj_name,
"Pool is not released by application, releasing now"));
pj_pool_destroy_int(pool);
pool = next;
}
if (cp->lock) {
pj_lock_destroy(cp->lock);
pj_lock_create_null_mutex(NULL, "cachingpool", &cp->lock);
}
}
示例11: PJ_DEF
PJ_DEF(void) pj_timer_heap_set_lock( pj_timer_heap_t *ht,
pj_lock_t *lock,
pj_bool_t auto_del )
{
PJ_UNUSED_ARG(ht);
if (auto_del)
pj_lock_destroy(lock);
}
示例12: RING_DBG
SipIceTransport::~SipIceTransport()
{
RING_DBG("[email protected]%p", this);
Manager::instance().unregisterEventHandler((uintptr_t)this);
pj_lock_destroy(trData_.base.lock);
pj_atomic_destroy(trData_.base.ref_cnt);
RING_DBG("destroying [email protected]%p", this);
}
示例13: ioqueue_destroy
static pj_status_t ioqueue_destroy(pj_ioqueue_t *ioqueue)
{
if (ioqueue->auto_delete_lock && ioqueue->lock ) {
pj_lock_release(ioqueue->lock);
return pj_lock_destroy(ioqueue->lock);
}
return PJ_SUCCESS;
}
示例14: PJ_DEF
PJ_DEF(void) pj_timer_heap_set_lock( pj_timer_heap_t *ht,
pj_lock_t *lock,
pj_bool_t auto_del )
{
if (ht->lock && ht->auto_delete_lock)
pj_lock_destroy(ht->lock);
ht->lock = lock;
ht->auto_delete_lock = auto_del;
}
示例15: PJ_DEF
PJ_DEF(pj_status_t) pj_stun_session_create( pj_stun_config *cfg,
const char *name,
const pj_stun_session_cb *cb,
pj_bool_t fingerprint,
pj_stun_session **p_sess)
{
pj_pool_t *pool;
pj_stun_session *sess;
pj_status_t status;
PJ_ASSERT_RETURN(cfg && cb && p_sess, PJ_EINVAL);
if (name==NULL)
name = "stuse%p";
pool = pj_pool_create(cfg->pf, name, PJNATH_POOL_LEN_STUN_SESS,
PJNATH_POOL_INC_STUN_SESS, NULL);
PJ_ASSERT_RETURN(pool, PJ_ENOMEM);
sess = PJ_POOL_ZALLOC_T(pool, pj_stun_session);
sess->cfg = cfg;
sess->pool = pool;
pj_memcpy(&sess->cb, cb, sizeof(*cb));
sess->use_fingerprint = fingerprint;
sess->log_flag = 0xFFFF;
sess->srv_name.ptr = (char*) pj_pool_alloc(pool, 32);
sess->srv_name.slen = pj_ansi_snprintf(sess->srv_name.ptr, 32,
"pjnath-%s", pj_get_version());
sess->rx_pool = pj_pool_create(sess->cfg->pf, name,
PJNATH_POOL_LEN_STUN_TDATA,
PJNATH_POOL_INC_STUN_TDATA, NULL);
pj_list_init(&sess->pending_request_list);
pj_list_init(&sess->cached_response_list);
status = pj_lock_create_recursive_mutex(pool, name, &sess->lock);
if (status != PJ_SUCCESS) {
pj_pool_release(pool);
return status;
}
sess->delete_lock = PJ_TRUE;
status = pj_atomic_create(pool, 0, &sess->busy);
if (status != PJ_SUCCESS) {
pj_lock_destroy(sess->lock);
pj_pool_release(pool);
return status;
}
*p_sess = sess;
return PJ_SUCCESS;
}