EAPI int eio_shutdown(void) { Eio_File_Direct_Info *info; Eio_File_Char *cin; Eio_Progress *pg; Eio_File_Associate *asso; if (_eio_init_count <= 0) { ERR("Init count not greater than 0 in shutdown."); return 0; } if (--_eio_init_count != 0) return _eio_init_count; eina_log_timing(_eio_log_dom_global, EINA_LOG_STATE_START, EINA_LOG_STATE_SHUTDOWN); eio_monitor_shutdown(); eina_condition_free(&(memory_pool_cond)); eina_lock_free(&(memory_pool_mutex)); eina_spinlock_free(&(memory_pool_lock)); eina_lock_free(&(direct_info_pool.lock)); eina_lock_free(&(progress_pool.lock)); eina_lock_free(&(char_pool.lock)); eina_lock_free(&(associate_pool.lock)); /* Cleanup pool */ EINA_TRASH_CLEAN(&progress_pool.trash, pg) free(pg); progress_pool.count = 0; EINA_TRASH_CLEAN(&direct_info_pool.trash, info) free(info); direct_info_pool.count = 0; EINA_TRASH_CLEAN(&char_pool.trash, cin) free(cin); char_pool.count = 0; EINA_TRASH_CLEAN(&associate_pool.trash, asso) free(asso); associate_pool.count = 0; ecore_shutdown(); eina_log_domain_unregister(_eio_log_dom_global); _eio_log_dom_global = -1; eina_shutdown(); return _eio_init_count; }
static void _eina_stringshare_small_shutdown(void) { Eina_Stringshare_Small_Bucket **p_bucket, **p_bucket_end; p_bucket = _eina_small_share.buckets; p_bucket_end = p_bucket + 256; for (; p_bucket < p_bucket_end; p_bucket++) { Eina_Stringshare_Small_Bucket *bucket = *p_bucket; char **s, **s_end; if (!bucket) continue; s = (char **)bucket->strings; s_end = s + bucket->count; for (; s < s_end; s++) free(*s); free((void *)bucket->strings); free(bucket->lengths); free(bucket->references); free(bucket); *p_bucket = NULL; } eina_lock_free(&_mutex_small); }
void enesim_barrier_free(Enesim_Barrier *barrier) { eina_condition_free(&(barrier->cond)); eina_lock_free(&(barrier->cond_lock)); barrier->needed = 0; barrier->called = 0; }
static void _thread_safe_cleanup(void *data) { Ecore_Safe_Call *call = data; eina_condition_free(&call->c); eina_lock_free(&call->m); }
static void eina_one_big_shutdown(void *data) { One_Big *pool = data; if (!pool) return; if (!eina_lock_take(&pool->mutex)) { #ifdef EINA_HAVE_DEBUG_THREADS assert(eina_thread_equal(pool->self, eina_thread_self())); #endif } if (pool->over > 0) { // FIXME: should we warn here? one_big mempool exceeded its alloc and now // mempool is cleaning up the mess created. be quiet for now as we were before // but edje seems to be a big offender at the moment! bad cedric! :) // WRN( // "Pool [%s] over by %i. cleaning up for you", // pool->name, pool->over); while (pool->over_list) { Eina_Inlist *il = pool->over_list; void *ptr = OVER_MEM_FROM_LIST(pool, il); pool->over_list = eina_inlist_remove(pool->over_list, il); free(ptr); pool->over--; } } if (pool->over > 0) { WRN( "Pool [%s] still over by %i\n", pool->name, pool->over); } #ifndef NVALGRIND VALGRIND_DESTROY_MEMPOOL(pool); #endif if (pool->base) free(pool->base); eina_lock_release(&pool->mutex); eina_lock_free(&pool->mutex); free(pool); }
void bks_model_shutdown(void) { eina_lock_free(&mdl.lock); efreet_shutdown(); ecore_file_shutdown(); }
EAPI int eio_shutdown(void) { Eio_File_Direct_Info *info; Eio_File_Char *cin; Eio_Progress *pg; Eio_File_Associate *asso; Eio_File *f; Eina_List *l; if (_eio_init_count <= 0) { ERR("Init count not greater than 0 in shutdown."); return 0; } if (--_eio_init_count != 0) return _eio_init_count; eina_log_timing(_eio_log_dom_global, EINA_LOG_STATE_START, EINA_LOG_STATE_SHUTDOWN); efl_del(io_manager); io_manager = NULL; EINA_LIST_FOREACH(tracked_thread, l, f) ecore_thread_cancel(f->thread); EINA_LIST_FREE(tracked_thread, f) { if (!ecore_thread_wait(f->thread, 0.5)) CRI("We couldn't terminate in less than 30s some pending IO. This can led to some crash."); } efreet_mime_shutdown(); eio_monitor_shutdown(); eina_condition_free(&(memory_pool_cond)); eina_lock_free(&(memory_pool_mutex)); eina_spinlock_free(&(memory_pool_lock)); eina_lock_free(&(direct_info_pool.lock)); eina_lock_free(&(progress_pool.lock)); eina_lock_free(&(char_pool.lock)); eina_lock_free(&(associate_pool.lock)); /* Cleanup pool */ EINA_TRASH_CLEAN(&progress_pool.trash, pg) free(pg); progress_pool.count = 0; EINA_TRASH_CLEAN(&direct_info_pool.trash, info) free(info); direct_info_pool.count = 0; EINA_TRASH_CLEAN(&char_pool.trash, cin) free(cin); char_pool.count = 0; EINA_TRASH_CLEAN(&associate_pool.trash, asso) free(asso); associate_pool.count = 0; ecore_shutdown(); eina_log_domain_unregister(_eio_log_dom_global); _eio_log_dom_global = -1; eina_shutdown(); return _eio_init_count; }
/** * Shut down connections, signal handlers sockets etc. * * This function shuts down all things set up in ecore_init() and cleans up all * event queues, handlers, filters, timers, idlers, idle enterers/exiters * etc. set up after ecore_init() was called. * * Do not call this function from any callback that may be called from the main * loop, as the main loop will then fall over and not function properly. */ EAPI int ecore_shutdown(void) { /* * take a lock here because _ecore_event_shutdown() does callbacks */ _ecore_lock(); if (--_ecore_init_count != 0) goto unlock; /* this looks horrible - a hack for now, but something to note. as * we delete the _thread_call pipe a thread COULD be doing * ecore_pipe_write() or what not to it at the same time - we * must ensure all possible users of this _thread_call are finished * and exited before we delete it here */ /* * ok - this causes other valgrind complaints regarding glib aquiring * locks internally. so fix bug a or bug b. let's leave the original * bug in then and leave this as a note for now Ecore_Pipe *p; p = _thread_call; _thread_call = NULL; ecore_pipe_wait(p, 1, 0.1); ecore_pipe_del(p); */ eina_lock_free(&_thread_safety); eina_condition_free(&_thread_cond); eina_lock_free(&_thread_mutex); eina_condition_free(&_thread_feedback_cond); eina_lock_free(&_thread_feedback_mutex); eina_lock_free(&_thread_id_lock); if (_ecore_fps_debug) _ecore_fps_debug_shutdown(); _ecore_poller_shutdown(); _ecore_animator_shutdown(); _ecore_glib_shutdown(); _ecore_job_shutdown(); _ecore_thread_shutdown(); _ecore_exe_shutdown(); _ecore_idle_enterer_shutdown(); _ecore_idle_exiter_shutdown(); _ecore_idler_shutdown(); _ecore_timer_shutdown(); _ecore_event_shutdown(); _ecore_main_shutdown(); _ecore_signal_shutdown(); _ecore_main_loop_shutdown(); #if HAVE_MALLINFO if (getenv("ECORE_MEM_STAT")) { _ecore_memory_statistic(NULL); ERR("[%i] Memory MAX total: %i, free: %i", _ecore_memory_pid, _ecore_memory_max_total, _ecore_memory_max_free); } #endif ecore_mempool_shutdown(); eina_log_domain_unregister(_ecore_log_dom); _ecore_log_dom = -1; eina_shutdown(); #ifdef HAVE_EVIL evil_shutdown(); #endif unlock: _ecore_unlock(); return _ecore_init_count; }
Eina_Bool eina_tmpstr_shutdown(void) { eina_lock_free(&_mutex); return EINA_TRUE; }