这篇教程C++ switch_core_destroy_memory_pool函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中switch_core_destroy_memory_pool函数的典型用法代码示例。如果您正苦于以下问题:C++ switch_core_destroy_memory_pool函数的具体用法?C++ switch_core_destroy_memory_pool怎么用?C++ switch_core_destroy_memory_pool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了switch_core_destroy_memory_pool函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: switch_log_printfstatic dir_profile_t *load_profile(const char *profile_name){ dir_profile_t *profile = NULL; switch_xml_t x_profiles, x_profile, cfg, xml = NULL; switch_event_t *event = NULL; if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed/n", global_cf); return profile; } if (!(x_profiles = switch_xml_child(cfg, "profiles"))) { goto end; } if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile_name))) { switch_memory_pool_t *pool; int count; if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure/n"); goto end; } if (!(profile = switch_core_alloc(pool, sizeof(dir_profile_t)))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure/n"); switch_core_destroy_memory_pool(&pool); goto end; } profile->pool = pool; profile_set_config(profile); /* Add the params to the event structure */ count = (int)switch_event_import_xml(switch_xml_child(x_profile, "param"), "name", "value", &event); if (switch_xml_config_parse_event(event, count, SWITCH_FALSE, profile->config) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to process configuration/n"); switch_core_destroy_memory_pool(&pool); goto end; } switch_thread_rwlock_create(&profile->rwlock, pool); profile->name = switch_core_strdup(pool, profile_name); switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, profile->pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added Profile %s/n", profile->name); switch_core_hash_insert(globals.profile_hash, profile->name, profile); } end: switch_xml_free(xml); return profile;}
开发者ID:DrumTechnologiesLtd,项目名称:FreeSWITCH,代码行数:54,
示例2: SWITCH_DECLARESWITCH_DECLARE(void) EventConsumer::cleanup(){ uint32_t i; void *pop; if (!ready) { return; } ready = 0; for (i = 0; i < node_index; i++) { switch_event_unbind(&enodes[i]); } node_index = 0; if (events) { switch_queue_interrupt_all(events); } while(switch_queue_trypop(events, &pop) == SWITCH_STATUS_SUCCESS) { switch_event_t *event = (switch_event_t *) pop; switch_event_destroy(&event); } switch_core_destroy_memory_pool(&pool);}
开发者ID:PauloFer1,项目名称:FreeSWITCH,代码行数:31,
示例3: whilestatic void *torture_thread(switch_thread_t *thread, void *obj){ int y = 0; int z = 0; switch_core_thread_session_t *ts = obj; switch_event_t *event; z = THREADS++; while (THREADS > 0) { int x; for (x = 0; x < 1; x++) { if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_COOL) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, "event_info", "hello world %d %d", z, y++); switch_event_fire(&event); } } switch_yield(100000); } if (ts->pool) { switch_memory_pool_t *pool = ts->pool; switch_core_destroy_memory_pool(&pool); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Thread Ended/n");}
开发者ID:moises-silva,项目名称:mod_handsfree,代码行数:27,
示例4: switch_ivr_menu_stack_freeSWITCH_DECLARE_CONSTRUCTOR IVRMenu::~IVRMenu(){ if (menu) { switch_ivr_menu_stack_free(menu); } switch_core_destroy_memory_pool(&pool);}
开发者ID:gujun,项目名称:sscore,代码行数:7,
示例5: limit_remote_destroyvoid limit_remote_destroy(limit_remote_t **r){ if (r && *r) { switch_hash_index_t *hi; (*r)->state = REMOTE_OFF; if ((*r)->thread) { switch_status_t retval; switch_thread_join(&retval, (*r)->thread); } switch_thread_rwlock_wrlock((*r)->rwlock); /* Free hashtable data */ for (hi = switch_hash_first(NULL, (*r)->index); hi; hi = switch_hash_next(hi)) { void *val; const void *key; switch_ssize_t keylen; switch_hash_this(hi, &key, &keylen, &val); free(val); } switch_thread_rwlock_unlock((*r)->rwlock); switch_thread_rwlock_destroy((*r)->rwlock); switch_core_destroy_memory_pool(&((*r)->pool)); *r = NULL; }}
开发者ID:moises-silva,项目名称:mod_conference-admin,代码行数:31,
示例6: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename, switch_memory_pool_t *pool){ int32_t wanted = APR_FINFO_TYPE; switch_memory_pool_t *our_pool = NULL; switch_status_t status = SWITCH_STATUS_FALSE; apr_finfo_t info = { 0 }; if (zstr(filename)) { return status; } if (!pool) { switch_core_new_memory_pool(&our_pool); } apr_stat(&info, filename, wanted, pool ? pool : our_pool); if (info.filetype != APR_NOFILE) { status = SWITCH_STATUS_SUCCESS; } if (our_pool) { switch_core_destroy_memory_pool(&our_pool); } return status;}
开发者ID:benlangfeld,项目名称:FreeSWITCH,代码行数:26,
示例7: switch_thread_cond_destroy //SavedCondition(const SavedCondition &); ~SavedCondition() { switch_thread_cond_destroy(_condition); switch_mutex_destroy(_mutex); if(_can_delete_pool) switch_core_destroy_memory_pool(&_pool); }
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:9,
示例8: DestroyCallWSClientParser::~WSClientParser() { // TODO Auto-generated destructor stub DestroyCall(); switch_mutex_destroy(clientMutex); switch_core_destroy_memory_pool(&mpPool); mpPool = NULL;}
开发者ID:KingsleyYau,项目名称:CamShareMiddleware,代码行数:10,
示例9: switch_event_unbindSWITCH_DECLARE_CONSTRUCTOR EventConsumer::~EventConsumer(){ if (node) { switch_event_unbind(&node); } if (events) { switch_queue_interrupt_all(events); } switch_core_destroy_memory_pool(&pool);}
开发者ID:gujun,项目名称:sscore,代码行数:12,
示例10: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_core_directory_close(switch_directory_handle_t *dh){ switch_status_t status; status = dh->directory_interface->directory_close(dh); UNPROTECT_INTERFACE(dh->directory_interface); if (switch_test_flag(dh, SWITCH_DIRECTORY_FLAG_FREE_POOL)) { switch_core_destroy_memory_pool(&dh->memory_pool); } return status;}
开发者ID:gujun,项目名称:sscore,代码行数:13,
示例11: switch_event_unbindSWITCH_DECLARE_CONSTRUCTOR EventConsumer::~EventConsumer(){ uint32_t i; for (i = 0; i < node_index; i++) { switch_event_unbind(&enodes[i]); } if (events) { switch_queue_interrupt_all(events); } switch_core_destroy_memory_pool(&pool);}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:14,
示例12: do_loadstatic void do_load(void){ switch_mutex_lock(MUTEX); if (globals.pool) { switch_core_destroy_memory_pool(&globals.pool); } memset(&globals, 0, sizeof(globals)); switch_core_new_memory_pool(&globals.pool); globals.timeout = 10; load_config(); switch_mutex_unlock(MUTEX);}
开发者ID:PauloFer1,项目名称:FreeSWITCH,代码行数:14,
示例13: task_own_threadstatic void *SWITCH_THREAD_FUNC task_own_thread(switch_thread_t *thread, void *obj){ switch_scheduler_task_container_t *tp = (switch_scheduler_task_container_t *) obj; switch_memory_pool_t *pool; pool = tp->pool; tp->pool = NULL; switch_scheduler_execute(tp); switch_core_destroy_memory_pool(&pool); tp->in_thread = 0; return NULL;}
开发者ID:bodji,项目名称:freeswitch,代码行数:14,
示例14: mongo_connection_pool_createswitch_status_t mongo_connection_pool_create(mongo_connection_pool_t **conn_pool, switch_size_t min_connections, switch_size_t max_connections, const char *conn_str){ switch_memory_pool_t *pool = NULL; switch_status_t status = SWITCH_STATUS_SUCCESS; mongo_connection_pool_t *cpool = NULL; DBClientBase *conn = NULL; if ((status = switch_core_new_memory_pool(&pool)) != SWITCH_STATUS_SUCCESS) { return status; } if (!(cpool = (mongo_connection_pool_t *)switch_core_alloc(pool, sizeof(mongo_connection_pool_t)))) { switch_goto_status(SWITCH_STATUS_MEMERR, done); } if ((status = switch_mutex_init(&cpool->mutex, SWITCH_MUTEX_NESTED, pool)) != SWITCH_STATUS_SUCCESS) { goto done; } if ((status = switch_queue_create(&cpool->connections, max_connections, pool)) != SWITCH_STATUS_SUCCESS) { goto done; } cpool->min_connections = min_connections; cpool->max_connections = max_connections; cpool->conn_str = switch_core_strdup(pool, conn_str); cpool->pool = pool; for (cpool->size = 0; cpool->size < min_connections; cpool->size++) { if (mongo_connection_create(&conn, conn_str) == SWITCH_STATUS_SUCCESS) { mongo_connection_pool_put(cpool, conn); } else { break; } } done: if (status == SWITCH_STATUS_SUCCESS) { *conn_pool = cpool; } else { switch_core_destroy_memory_pool(&pool); } return status;}
开发者ID:moises-silva,项目名称:mod_conference-admin,代码行数:50,
示例15: socket_destroystatic void socket_destroy(JSContext * cx, JSObject * obj){ js_socket_obj_t *socket = JS_GetPrivate(cx, obj); if (socket == NULL) return; if (socket->socket != 0) { socket->saveDepth = JS_SuspendRequest(cx); switch_socket_shutdown(socket->socket, SWITCH_SHUTDOWN_READWRITE); switch_socket_close(socket->socket); switch_core_destroy_memory_pool(&socket->pool); JS_ResumeRequest(cx, socket->saveDepth); }}
开发者ID:DastanIqbal,项目名称:FreeSWITCH,代码行数:15,
示例16: mod_amqp_logging_destroyswitch_status_t mod_amqp_logging_destroy(mod_amqp_logging_profile_t **prof){ mod_amqp_message_t *msg = NULL; switch_status_t status = SWITCH_STATUS_SUCCESS; mod_amqp_connection_t *conn = NULL, *conn_next = NULL; switch_memory_pool_t *pool; mod_amqp_logging_profile_t *profile; if (!prof || !*prof) { return SWITCH_STATUS_SUCCESS; } profile = *prof; pool = profile->pool; if (profile->name) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Profile[%s] shutting down.../n", profile->name); switch_core_hash_delete(globals.logging_hash, profile->name); } profile->running = 0; if (profile->logging_thread) { switch_thread_join(&status, profile->logging_thread); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Profile[%s] closing AMQP socket.../n", profile->name); for (conn = profile->conn_root; conn; conn = conn_next) { conn_next = conn->next; mod_amqp_connection_destroy(&conn); } profile->conn_active = NULL; profile->conn_root = NULL; while (profile->send_queue && switch_queue_trypop(profile->send_queue, (void**)&msg) == SWITCH_STATUS_SUCCESS) { mod_amqp_util_msg_destroy(&msg); } if (pool) { switch_core_destroy_memory_pool(&pool); } *prof = NULL; return SWITCH_STATUS_SUCCESS;}
开发者ID:skyeyester,项目名称:freeswitch,代码行数:48,
示例17: mongo_connection_pool_destroyvoid mongo_connection_pool_destroy(mongo_connection_pool_t **conn_pool){ mongo_connection_pool_t *cpool = *conn_pool; void *data = NULL; switch_assert(cpool != NULL); while (switch_queue_trypop(cpool->connections, &data) == SWITCH_STATUS_SUCCESS) { mongo_connection_destroy((DBClientBase **)&data); } switch_mutex_destroy(cpool->mutex); switch_core_destroy_memory_pool(&cpool->pool); *conn_pool = NULL;}
开发者ID:AricGod,项目名称:FreeSWITCH,代码行数:16,
示例18: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t *stack){ switch_status_t status = SWITCH_STATUS_FALSE; if (stack != NULL && stack->pool != NULL) { if (switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_STACK) && switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_FREEPOOL)) { switch_memory_pool_t *pool = stack->pool; status = switch_core_destroy_memory_pool(&pool); } else { status = SWITCH_STATUS_SUCCESS; } } return status;}
开发者ID:hsaid,项目名称:FreeSWITCH,代码行数:16,
示例19: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_core_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags){ switch_status_t status; switch_assert(ah != NULL); status = ah->asr_interface->asr_close(ah, flags); switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED); UNPROTECT_INTERFACE(ah->asr_interface); if (switch_test_flag(ah, SWITCH_ASR_FLAG_FREE_POOL)) { switch_core_destroy_memory_pool(&ah->memory_pool); } return status;}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:17,
示例20: teletone_destroystatic void teletone_destroy(JSContext * cx, JSObject * obj){ struct teletone_obj *tto = JS_GetPrivate(cx, obj); switch_memory_pool_t *pool; if (tto) { if (tto->timer) { switch_core_timer_destroy(tto->timer); } teletone_destroy_session(&tto->ts); switch_buffer_destroy(&tto->audio_buffer); switch_core_codec_destroy(&tto->codec); pool = tto->pool; tto->pool = NULL; if (pool) { switch_core_destroy_memory_pool(&pool); } }}
开发者ID:PauloFer1,项目名称:FreeSWITCH,代码行数:18,
示例21: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_core_timer_destroy(switch_timer_t *timer){ if (!timer->timer_interface || !timer->timer_interface->timer_destroy) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer is not properly configured./n"); return SWITCH_STATUS_GENERR; } timer->timer_interface->timer_destroy(timer); UNPROTECT_INTERFACE(timer->timer_interface); if (switch_test_flag(timer, SWITCH_TIMER_FLAG_FREE_POOL)) { switch_core_destroy_memory_pool(&timer->memory_pool); } memset(timer, 0, sizeof(*timer)); return SWITCH_STATUS_SUCCESS;}
开发者ID:DastanIqbal,项目名称:FreeSWITCH,代码行数:18,
示例22: switch_core_new_memory_pool/** * Create new output component */static struct rayo_component *create_output_component(struct rayo_actor *actor, const char *type, iks *output, const char *client_jid){ switch_memory_pool_t *pool; struct output_component *output_component = NULL; switch_core_new_memory_pool(&pool); output_component = switch_core_alloc(pool, sizeof(*output_component)); output_component = OUTPUT_COMPONENT(rayo_component_init((struct rayo_component *)output_component, pool, type, "output", NULL, actor, client_jid)); if (output_component) { output_component->document = iks_copy(output); output_component->start_offset_ms = iks_find_int_attrib(output, "start-offset"); output_component->repeat_interval_ms = iks_find_int_attrib(output, "repeat-interval"); output_component->repeat_times = iks_find_int_attrib(output, "repeat-times"); output_component->max_time_ms = iks_find_int_attrib(output, "max-time"); output_component->start_paused = iks_find_bool_attrib(output, "start-paused"); output_component->renderer = switch_core_strdup(RAYO_POOL(output_component), iks_find_attrib_soft(output, "renderer")); /* get custom headers */ { switch_stream_handle_t headers = { 0 }; iks *header = NULL; int first = 1; SWITCH_STANDARD_STREAM(headers); for (header = iks_find(output, "header"); header; header = iks_next_tag(header)) { if (!strcmp("header", iks_name(header))) { const char *name = iks_find_attrib_soft(header, "name"); const char *value = iks_find_attrib_soft(header, "value"); if (!zstr(name) && !zstr(value)) { headers.write_function(&headers, "%s%s=%s", first ? "{" : ",", name, value); first = 0; } } } if (headers.data) { headers.write_function(&headers, "}"); output_component->headers = switch_core_strdup(RAYO_POOL(output_component), (char *)headers.data); free(headers.data); } } } else { switch_core_destroy_memory_pool(&pool); } return RAYO_COMPONENT(output_component);}
开发者ID:odmanV2,项目名称:freecenter,代码行数:47,
示例23: mod_amqp_command_destroyswitch_status_t mod_amqp_command_destroy(mod_amqp_command_profile_t **prof){ switch_status_t ret; mod_amqp_connection_t *conn = NULL, *conn_next = NULL; switch_memory_pool_t *pool; mod_amqp_command_profile_t *profile; if (!prof || !*prof) { return SWITCH_STATUS_SUCCESS; } profile = *prof; pool = profile->pool; if (profile->name) { switch_core_hash_delete(globals.command_hash, profile->name); } profile->running = 0; if (profile->command_thread) { switch_thread_join(&ret, profile->command_thread); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Profile[%s] closing AMQP socket.../n", profile->name); for (conn = profile->conn_root; conn; conn = conn_next) { mod_amqp_connection_destroy(&conn); } profile->conn_active = NULL; profile->conn_root = NULL; if (pool) { switch_core_destroy_memory_pool(&pool); } *prof = NULL; return SWITCH_STATUS_SUCCESS;}
开发者ID:odmanV2,项目名称:freecenter,代码行数:41,
示例24: SWITCH_DECLARESWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, switch_memory_pool_t *pool){ apr_dir_t *dir_handle; switch_memory_pool_t *our_pool = NULL; switch_status_t status; if (!pool) { switch_core_new_memory_pool(&our_pool); pool = our_pool; } if ((status = apr_dir_open(&dir_handle, dirname, pool)) == APR_SUCCESS) { apr_dir_close(dir_handle); } if (our_pool) { switch_core_destroy_memory_pool(&our_pool); } return status;}
开发者ID:gujun,项目名称:sscore,代码行数:21,
示例25: socket_constructstatic JSBool socket_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval){ js_socket_obj_t *js_socket_obj = 0; switch_memory_pool_t *pool; switch_socket_t *socket; switch_status_t ret; switch_core_new_memory_pool(&pool); ret = switch_socket_create(&socket, AF_INET, SOCK_STREAM, SWITCH_PROTO_TCP, pool); if (ret != SWITCH_STATUS_SUCCESS) { switch_core_destroy_memory_pool(&pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Failed to create socket, reason: %d./n", ret); return JS_FALSE; } // allocate information needed by JS to be able to write to the log. // (needed since multitple js sessions can write to the same log) js_socket_obj = switch_core_alloc(pool, sizeof(js_socket_obj_t)); js_socket_obj->pool = pool; js_socket_obj->socket = socket; JS_SetPrivate(cx, obj, js_socket_obj); return JS_TRUE;}
开发者ID:DastanIqbal,项目名称:FreeSWITCH,代码行数:22,
注:本文中的switch_core_destroy_memory_pool函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ switch_core_hash_find函数代码示例 C++ switch_core_codec_ready函数代码示例 |