/******************************************************************//** Frees the resources in a wait array. */ UNIV_INTERN void sync_array_free( /*============*/ sync_array_t* arr) /*!< in, own: sync wait array */ { ulint protection; ut_a(arr->n_reserved == 0); sync_array_validate(arr); protection = arr->protection; /* Release the mutex protecting the wait array complex */ if (protection == SYNC_ARRAY_OS_MUTEX) { os_mutex_free(arr->os_mutex); } else if (protection == SYNC_ARRAY_MUTEX) { mutex_free(&(arr->mutex)); } else { ut_error; } ut_free(arr->array); ut_free(arr); }
/*********************************************************//** Frees created events and OS 'slow' mutexes. */ UNIV_INTERN void os_sync_free(void) /*==============*/ { os_event_t event; os_mutex_t mutex; os_sync_free_called = TRUE; event = UT_LIST_GET_FIRST(os_event_list); while (event) { os_event_free(event); event = UT_LIST_GET_FIRST(os_event_list); } mutex = UT_LIST_GET_FIRST(os_mutex_list); while (mutex) { if (mutex == os_sync_mutex) { /* Set the flag to FALSE so that we do not try to reserve os_sync_mutex any more in remaining freeing operations in shutdown */ os_sync_mutex_inited = FALSE; } os_mutex_free(mutex); mutex = UT_LIST_GET_FIRST(os_mutex_list); } os_sync_free_called = FALSE; }