本文整理汇总了C++中pj_mutex_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ pj_mutex_destroy函数的具体用法?C++ pj_mutex_destroy怎么用?C++ pj_mutex_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pj_mutex_destroy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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_lock_acquire(ioqueue->lock);
#if PJ_IOQUEUE_HAS_SAFE_UNREG
/* Destroy reference counters */
key = ioqueue->active_list.next;
while (key != &ioqueue->active_list) {
pj_mutex_destroy(key->mutex);
key = key->next;
}
key = ioqueue->closing_list.next;
while (key != &ioqueue->closing_list) {
pj_mutex_destroy(key->mutex);
key = key->next;
}
key = ioqueue->free_list.next;
while (key != &ioqueue->free_list) {
pj_mutex_destroy(key->mutex);
key = key->next;
}
pj_mutex_destroy(ioqueue->ref_cnt_mutex);
#endif
return ioqueue_destroy(ioqueue);
}
开发者ID:kaaustubh,项目名称:pjsip,代码行数:38,代码来源:ioqueue_select.c
示例2: PJ_DEF
/*
* pj_ioqueue_destroy()
*/
PJ_DEF(pj_status_t) pj_ioqueue_destroy( pj_ioqueue_t *ioqueue )
{
#if PJ_HAS_TCP
unsigned i;
#endif
pj_ioqueue_key_t *key;
PJ_CHECK_STACK();
PJ_ASSERT_RETURN(ioqueue, PJ_EINVAL);
pj_lock_acquire(ioqueue->lock);
#if PJ_HAS_TCP
/* Destroy events in the pool */
for (i=0; i<ioqueue->event_count; ++i) {
CloseHandle(ioqueue->event_pool[i]);
}
ioqueue->event_count = 0;
#endif
if (CloseHandle(ioqueue->iocp) != TRUE)
return PJ_RETURN_OS_ERROR(GetLastError());
#if PJ_IOQUEUE_HAS_SAFE_UNREG
/* Destroy reference counters */
key = ioqueue->active_list.next;
while (key != &ioqueue->active_list) {
pj_atomic_destroy(key->ref_count);
pj_mutex_destroy(key->mutex);
key = key->next;
}
key = ioqueue->closing_list.next;
while (key != &ioqueue->closing_list) {
pj_atomic_destroy(key->ref_count);
pj_mutex_destroy(key->mutex);
key = key->next;
}
key = ioqueue->free_list.next;
while (key != &ioqueue->free_list) {
pj_atomic_destroy(key->ref_count);
pj_mutex_destroy(key->mutex);
key = key->next;
}
#endif
if (ioqueue->auto_delete_lock)
pj_lock_destroy(ioqueue->lock);
return PJ_SUCCESS;
}
开发者ID:carlosdelfino,项目名称:WorkshopTelefoniaAutomacao,代码行数:55,代码来源:ioqueue_winnt.c
示例3: job_queue_destroy
static pj_status_t job_queue_destroy(job_queue *jq)
{
unsigned i;
jq->is_quitting = PJ_TRUE;
if (jq->thread) {
pj_sem_post(jq->sem);
pj_thread_join(jq->thread);
pj_thread_destroy(jq->thread);
}
if (jq->sem) {
pj_sem_destroy(jq->sem);
jq->sem = NULL;
}
for (i = 0; i < jq->size; i++) {
if (jq->job_sem[i]) {
pj_sem_destroy(jq->job_sem[i]);
jq->job_sem[i] = NULL;
}
}
if (jq->mutex) {
pj_mutex_destroy(jq->mutex);
jq->mutex = NULL;
}
return PJ_SUCCESS;
}
开发者ID:CloudStyleStudio,项目名称:csip,代码行数:30,代码来源:android_opengl.c
示例4: PJ_DEF
/*
* pj_shutdown(void)
*/
PJ_DEF(void) pj_shutdown()
{
int i;
/* Call atexit() functions */
for (i=atexit_count-1; i>=0; --i) {
(*atexit_func[i])();
}
atexit_count = 0;
/* Free exception ID */
if (PJ_NO_MEMORY_EXCEPTION != -1) {
pj_exception_id_free(PJ_NO_MEMORY_EXCEPTION);
PJ_NO_MEMORY_EXCEPTION = -1;
}
#if PJ_HAS_THREADS
/* Destroy PJLIB critical section */
pj_mutex_destroy(&critical_section);
/* Free PJLIB TLS */
if (thread_tls_id != -1) {
pj_thread_local_free(thread_tls_id);
thread_tls_id = -1;
}
#endif
/* Clear static variables */
pj_errno_clear_handlers();
}
开发者ID:max3903,项目名称:SFLphone,代码行数:33,代码来源:os_core_unix.c
示例5: PJ_DEF
PJ_DEF(void) pjmedia_event_mgr_destroy(pjmedia_event_mgr *mgr)
{
if (!mgr) mgr = pjmedia_event_mgr_instance();
PJ_ASSERT_ON_FAIL(mgr != NULL, return);
if (mgr->thread) {
mgr->is_quitting = PJ_TRUE;
pj_sem_post(mgr->sem);
pj_thread_join(mgr->thread);
}
if (mgr->sem) {
pj_sem_destroy(mgr->sem);
mgr->sem = NULL;
}
if (mgr->mutex) {
pj_mutex_destroy(mgr->mutex);
mgr->mutex = NULL;
}
if (mgr->pool)
pj_pool_release(mgr->pool);
if (event_manager_instance == mgr)
event_manager_instance = NULL;
}
开发者ID:LuLei2013,项目名称:pjproject,代码行数:27,代码来源:event.c
示例6: destroy
//
// Destroy mutex.
//
void destroy()
{
if (mutex_) {
pj_mutex_destroy(mutex_);
mutex_ = NULL;
}
}
开发者ID:0x0B501E7E,项目名称:pjproject,代码行数:10,代码来源:os.hpp
示例7: PJ_DEF
/*
* Destroy reader/writer mutex.
*
*/
PJ_DEF(pj_status_t) pj_rwmutex_destroy(pj_rwmutex_t *mutex)
{
PJ_ASSERT_RETURN(mutex, PJ_EINVAL);
pj_mutex_destroy(mutex->read_lock);
pj_sem_destroy(mutex->write_lock);
return PJ_SUCCESS;
}
开发者ID:deveck,项目名称:Deveck.TAM,代码行数:11,代码来源:os_rwmutex.c
示例8: PJ_DEF
/*
* Unregister G722 codec factory from pjmedia endpoint and deinitialize
* the G722 codec library.
*/
PJ_DEF(pj_status_t) pjmedia_codec_g722_deinit(void)
{
pjmedia_codec_mgr *codec_mgr;
pj_status_t status;
if (g722_codec_factory.pool == NULL)
return PJ_SUCCESS;
/* Get the codec manager. */
codec_mgr = pjmedia_endpt_get_codec_mgr(g722_codec_factory.endpt);
if (!codec_mgr) {
pj_pool_release(g722_codec_factory.pool);
g722_codec_factory.pool = NULL;
return PJ_EINVALIDOP;
}
/* Unregister G722 codec factory. */
status = pjmedia_codec_mgr_unregister_factory(codec_mgr,
&g722_codec_factory.base);
/* Destroy mutex. */
pj_mutex_destroy(g722_codec_factory.mutex);
/* Destroy pool. */
pj_pool_release(g722_codec_factory.pool);
g722_codec_factory.pool = NULL;
TRACE_((THIS_FILE, "G722 codec factory shutdown"));
return status;
}
开发者ID:AmoebaLabs,项目名称:pjsip,代码行数:34,代码来源:g722.c
示例9: mod_deinit
/*
* Module deinitialization.
* Called by endpoint.
*/
static pj_status_t mod_deinit( struct pjsip_module *mod )
{
pj_mutex_lock(mgr.mutex);
pj_mutex_destroy(mgr.mutex);
pjsip_endpt_destroy_pool(mgr.endpt, mgr.pool);
return 0;
}
开发者ID:svn2github,项目名称:pjproject,代码行数:11,代码来源:event_notify.c
示例10: PJ_DEF
/*
* Unregister CODEC2 codec factory from pjmedia endpoint and deinitialize
* the CODEC2 codec library.
*/
PJ_DEF(pj_status_t) pjmedia_codec_codec2_deinit(void)
{
pjmedia_codec_mgr *codec_mgr;
pj_status_t status;
if (codec2_codec_factory.pool == NULL)
return PJ_SUCCESS;
/* Get the codec manager. */
codec_mgr = pjmedia_endpt_get_codec_mgr(codec2_codec_factory.endpt);
if (!codec_mgr) {
pj_pool_release(codec2_codec_factory.pool);
codec2_codec_factory.pool = NULL;
return PJ_EINVALIDOP;
}
/* Unregister GSM codec factory. */
status = pjmedia_codec_mgr_unregister_factory(codec_mgr,
&codec2_codec_factory.base);
/* Destroy mutex. */
pj_mutex_destroy(codec2_codec_factory.mutex);
/* Destroy pool. */
pj_pool_release(codec2_codec_factory.pool);
codec2_codec_factory.pool = NULL;
return status;
}
开发者ID:Agostin,项目名称:csipsimple,代码行数:33,代码来源:pj_codec2.c
示例11: pj_mutex_lock
*/ PJ_DEF(pj_status_t) pjmedia_codec_opus_deinit(void) {
pjmedia_codec_mgr *codec_mgr;
pj_status_t status;
if (opus_factory.endpt == NULL) {
/* Not registered. */
return PJ_SUCCESS;
}
/* Lock mutex. */
pj_mutex_lock(opus_factory.mutex);
/* Get the codec manager. */
codec_mgr = pjmedia_endpt_get_codec_mgr(opus_factory.endpt);
if (!codec_mgr) {
opus_factory.endpt = NULL;
pj_mutex_unlock(opus_factory.mutex);
return PJ_EINVALIDOP;
}
/* Unregister opus codec factory. */
status = pjmedia_codec_mgr_unregister_factory(codec_mgr, &opus_factory.base);
opus_factory.endpt = NULL;
/* Destroy mutex. */
pj_mutex_destroy(opus_factory.mutex);
opus_factory.mutex = NULL;
/* Release pool. */
pj_pool_release(opus_factory.pool);
opus_factory.pool = NULL;
return status;
}
开发者ID:AntonioLebara,项目名称:ios-pjsip,代码行数:34,代码来源:opus.c
示例12: transport_destroy
/*
* destroy() is called when the transport is no longer needed.
*/
static pj_status_t transport_destroy(pjmedia_transport *tp)
{
struct tp_zrtp *zrtp = (struct tp_zrtp*)tp;
PJ_ASSERT_RETURN(tp, PJ_EINVAL);
PJ_LOG(4, (THIS_FILE, "Destroy - encrypted packets: %ld, decrypted packets: %ld",
zrtp->protect, zrtp->unprotect));
/* close the slave transport in case */
if (zrtp->close_slave && zrtp->slave_tp)
{
pjmedia_transport_close(zrtp->slave_tp);
}
/* Self destruct.. */
zrtp_DestroyWrapper(zrtp->zrtpCtx);
/* In case mutex is being acquired by other thread */
pj_mutex_lock(zrtp->zrtpMutex);
pj_mutex_unlock(zrtp->zrtpMutex);
pj_mutex_destroy(zrtp->zrtpMutex);
pj_pool_release(zrtp->pool);
return PJ_SUCCESS;
}
开发者ID:jresende,项目名称:ZRTP4PJ,代码行数:29,代码来源:transport_zrtp.c
示例13: PJ_DEF
PJ_DEF(pj_status_t) pj_atomic_destroy( pj_atomic_t *atomic_var )
{
#if PJ_HAS_THREADS
return pj_mutex_destroy( atomic_var->mutex );
#else
return 0;
#endif
}
开发者ID:svn2github,项目名称:pjproject,代码行数:8,代码来源:os_unix.c
示例14: PJ_DEF
/*
* Destroy stream.
*/
PJ_DEF(pj_status_t) pjmedia_natnl_stream_destroy( natnl_stream *stream )
{
PJ_ASSERT_RETURN(stream != NULL, PJ_EINVAL);
/**
* don't need to destroy mutex here,
* after stream destroy, the mutex will also be freed
*/
#if 0
/* Free mutex */
if (stream->gcbuff_mutex) {
pj_mutex_destroy(stream->gcbuff_mutex);
stream->gcbuff_mutex = NULL;
}
if (stream->rbuff_mutex) {
pj_mutex_destroy(stream->rbuff_mutex);
stream->rbuff_mutex = NULL;
}
if (stream->sbuff_mutex) {
pj_mutex_destroy(stream->sbuff_mutex);
stream->sbuff_mutex = NULL;
}
#endif
#if 1 // DEAN don't release pool hear, let pjsip to release it.
if (stream->own_pool) {
//pj_pool_release(stream->own_pool);
stream->own_pool = NULL;
}
#endif
if (stream->rx_band) {
free(stream->rx_band);
stream->rx_band = NULL;
}
if (stream->tx_band) {
free(stream->tx_band);
stream->tx_band = NULL;
}
return PJ_SUCCESS;
}
开发者ID:rjknight123,项目名称:asuswrt-merlin,代码行数:48,代码来源:natnl_stream.c
示例15: PJ_DEF
PJ_DEF(pj_status_t) pjmedia_codec_opus_init(pjmedia_endpt *endpt) {
pjmedia_codec_mgr *codec_mgr;
pj_status_t status;
if (opus_factory.endpt != NULL) {
/* Already initialized. */
return PJ_SUCCESS;
}
/* Init factory */
opus_factory.base.op = &opus_factory_op;
opus_factory.base.factory_data = NULL;
opus_factory.endpt = endpt;
if (opus_factory.internal_clock_rate == 0) {
opus_factory.internal_clock_rate = 48000;
}
/* Create pool */
opus_factory.pool =
pjmedia_endpt_create_pool(endpt, "opus codecs", 4000, 4000);
if (!opus_factory.pool) return PJ_ENOMEM;
/* Init list */
pj_list_init(&opus_factory.codec_list);
/* Create mutex. */
status = pj_mutex_create_simple(opus_factory.pool, "opus codecs",
&opus_factory.mutex);
if (status != PJ_SUCCESS) goto on_error;
PJ_LOG(5, (THIS_FILE, "Init opus"));
/* Get the codec manager. */
codec_mgr = pjmedia_endpt_get_codec_mgr(endpt);
if (!codec_mgr) {
return PJ_EINVALIDOP;
}
PJ_LOG(5, (THIS_FILE, "Init opus > DONE"));
/* Register codec factory to endpoint. */
status = pjmedia_codec_mgr_register_factory(codec_mgr, &opus_factory.base);
if (status != PJ_SUCCESS) return status;
return PJ_SUCCESS;
on_error:
if (opus_factory.mutex) {
pj_mutex_destroy(opus_factory.mutex);
opus_factory.mutex = NULL;
}
if (opus_factory.pool) {
pj_pool_release(opus_factory.pool);
opus_factory.pool = NULL;
}
return status;
}
开发者ID:AntonioLebara,项目名称:ios-pjsip,代码行数:57,代码来源:opus.c
示例16: PJ_DEF
PJ_DEF(pj_status_t) pjmedia_codec_l16_init(pjmedia_endpt *endpt,
unsigned options)
{
pjmedia_codec_mgr *codec_mgr;
pj_status_t status;
PJ_UNUSED_ARG(options);
if (l16_factory.endpt != NULL) {
/* Already initialized. */
return PJ_SUCCESS;
}
/* Init factory */
l16_factory.base.op = &l16_factory_op;
l16_factory.base.factory_data = NULL;
l16_factory.endpt = endpt;
/* Create pool */
l16_factory.pool = pjmedia_endpt_create_pool(endpt, "l16", 4000, 4000);
if (!l16_factory.pool)
return PJ_ENOMEM;
/* Create mutex. */
status = pj_mutex_create_simple(l16_factory.pool, "l16",
&l16_factory.mutex);
if (status != PJ_SUCCESS)
goto on_error;
/* Get the codec manager. */
codec_mgr = pjmedia_endpt_get_codec_mgr(endpt);
if (!codec_mgr) {
return PJ_EINVALIDOP;
}
/* Register codec factory to endpoint. */
status = pjmedia_codec_mgr_register_factory(codec_mgr,
&l16_factory.base);
if (status != PJ_SUCCESS)
return status;
return PJ_SUCCESS;
on_error:
if (l16_factory.mutex) {
pj_mutex_destroy(l16_factory.mutex);
l16_factory.mutex = NULL;
}
if (l16_factory.pool) {
pj_pool_release(l16_factory.pool);
l16_factory.pool = NULL;
}
return status;
}
开发者ID:carlosdelfino,项目名称:WorkshopTelefoniaAutomacao,代码行数:57,代码来源:l16.c
示例17: PJ_DEF
/*
* pj_atomic_destroy()
*/
PJ_DEF(pj_status_t) pj_atomic_destroy( pj_atomic_t *atomic_var )
{
PJ_ASSERT_RETURN(atomic_var, PJ_EINVAL);
#if PJ_HAS_THREADS
return pj_mutex_destroy( atomic_var->mutex );
#else
return 0;
#endif
}
开发者ID:ChrisKwon,项目名称:spore,代码行数:12,代码来源:os_core_unix.c
示例18: PJ_DEF
/*
* pj_ioqueue_unregister()
*
* Unregister handle from ioqueue.
*/
PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_key_t *key)
{
pj_ioqueue_t *ioqueue;
struct epoll_event ev;
int status;
PJ_ASSERT_RETURN(key != NULL, PJ_EINVAL);
ioqueue = key->ioqueue;
/* Lock the key to make sure no callback is simultaneously modifying
* the key. We need to lock the key before ioqueue here to prevent
* deadlock.
*/
pj_mutex_lock(key->mutex);
/* Also lock ioqueue */
pj_lock_acquire(ioqueue->lock);
pj_assert(ioqueue->count > 0);
--ioqueue->count;
#if !PJ_IOQUEUE_HAS_SAFE_UNREG
pj_list_erase(key);
#endif
ev.events = 0;
ev.epoll_data = (epoll_data_type)key;
status = os_epoll_ctl( ioqueue->epfd, EPOLL_CTL_DEL, key->fd, &ev);
if (status != 0) {
pj_status_t rc = pj_get_os_error();
pj_lock_release(ioqueue->lock);
return rc;
}
/* Destroy the key. */
pj_sock_close(key->fd);
pj_lock_release(ioqueue->lock);
#if PJ_IOQUEUE_HAS_SAFE_UNREG
/* Mark key is closing. */
key->closing = 1;
/* Decrement counter. */
decrement_counter(key);
/* Done. */
pj_mutex_unlock(key->mutex);
#else
pj_mutex_destroy(key->mutex);
#endif
return PJ_SUCCESS;
}
开发者ID:Agostin,项目名称:csipsimple,代码行数:60,代码来源:ioqueue_epoll.c
示例19: PJ_DEF
/*
* pj_thread_destroy()
*/
PJ_DEF(pj_status_t) pj_thread_destroy(pj_thread_t *p)
{
PJ_CHECK_STACK();
/* Destroy mutex used to suspend thread */
if (p->suspended_mutex)
{
pj_mutex_destroy(p->suspended_mutex);
p->suspended_mutex = NULL;
}
/* Destroy mutex used to wait thread */
if (p->wait_mutex)
{
pj_mutex_destroy(p->wait_mutex);
p->wait_mutex = NULL;
}
return PJ_SUCCESS;
}
开发者ID:mnhorak,项目名称:PJSIP-CMake,代码行数:23,代码来源:os_core_android.c
示例20: mod_ua_unload
/*
* mod_ua_unload()
*
* Called when module is being unloaded.
*/
static pj_status_t mod_ua_unload(void)
{
pj_thread_local_free(pjsip_dlg_lock_tls_id);
pj_mutex_destroy(mod_ua.mutex);
/* Release pool */
if (mod_ua.pool) {
pjsip_endpt_release_pool( mod_ua.endpt, mod_ua.pool );
}
return PJ_SUCCESS;
}
开发者ID:nishantjr,项目名称:pjproject,代码行数:16,代码来源:sip_ua_layer.c
注:本文中的pj_mutex_destroy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论