void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) { struct super_block *sb=OFNI_BS_2SFFJ(c); CYG_ASSERTC(sb->s_gc_thread_handle); D1(printk("jffs2_stop_garbage_collect_thread\n")); /* Stop the thread and wait for it if necessary */ cyg_flag_setbits(&sb->s_gc_thread_flags,GC_THREAD_FLAG_STOP); D1(printk("jffs2_stop_garbage_collect_thread wait\n")); cyg_flag_wait(&sb->s_gc_thread_flags, GC_THREAD_FLAG_HAS_EXIT, CYG_FLAG_WAITMODE_OR| CYG_FLAG_WAITMODE_CLR); // Kill and free the resources ... this is safe due to the flag // from the thread. cyg_thread_kill(sb->s_gc_thread_handle); cyg_thread_delete(sb->s_gc_thread_handle); cyg_mutex_destroy(&sb->s_lock); cyg_flag_destroy(&sb->s_gc_thread_flags); }
// exit void reconos_hwsched_destroy() { cyg_thread_kill( reconos_hwsched_thread_handle ); cyg_cond_destroy(&reconos_hwsched_condvar); cyg_mutex_destroy(&reconos_hwsched_mutex); }
static int e_mutex_gc(lua_State *L) { cyg_mutex_t *mx; mx = (cyg_mutex_t *) check_user_data(L, 1, E_MUTEX); cyg_mutex_destroy(mx); return 0; }
/* * Cleanup internal resources used by this timer module. It deletes all * pending timer entries from the backend timer system as well. */ int bcm_timer_module_cleanup(bcm_timer_module_id module_id) { ecos_timer_list_t *list = (ecos_timer_list_t *)module_id; ecos_timer_entry_t *entry; int key; TIMERDBG("list %08x", list); /* * do nothing if the list has not been initialized */ if (!(list->flags&TIMER_LIST_FLAG_INIT)) return -1; /* * mark the big bang flag here so that no more callbacks * shall be scheduled or called from this point on... */ list->flags |= TIMER_LIST_FLAG_EXIT; /* * remove all backend timers here so that no timer expires after here. */ TIMER_LIST_LOCK(list); key = INTLOCK(); for (entry = list->used; entry != NULL; entry = entry->next) { ecos_del_timer(entry); } INTUNLOCK(key); TIMER_LIST_UNLOCK(list); /* * have to wait till all expired entries to have been handled */ for (entry = list->used; entry != NULL; entry = entry->next) { if ((entry->flags&TIMER_FLAG_DEFERRED) && !(entry->flags&TIMER_FLAG_FINISHED)) break; } cyg_mutex_destroy(&(list->lock)); /* now it should be safe to blindly free all the resources */ TIMER_FREE_LOCK_MECHANISM(); free(list); TIMERDBG("done"); return 0; }
void gw_mutex_destroy(gw_mutex_t *mutex) { cyg_mutex_destroy(mutex); }
void cyg_recursive_mutex_destroy( cyg_recursive_mutex_t *mx ) { // Fixme: need check here to verify if owner?? cyg_mutex_release(&(mx->mutex)); cyg_mutex_destroy(&(mx->mutex)); }