void application_thread_cleanup( TX_THREAD *thread_ptr, UINT condition ) { /* Determine if the thread was exited. */ if ( thread_ptr && condition == TX_THREAD_EXIT ) { malloc_transfer_to_curr_thread(thread_ptr->tx_thread_stack_start); malloc_transfer_to_curr_thread(thread_ptr); tx_thread_terminate( thread_ptr ); malloc_leak_check(thread_ptr, LEAK_CHECK_THREAD); tx_thread_delete( thread_ptr ); free( thread_ptr->tx_thread_stack_start ); free( thread_ptr ); } }
/** * Terminates the current thread * * This does nothing since ThreadX threads can exit by just returning * * @param thread : handle of the thread to terminate * * @returns WWD_SUCCESS on success, WICED_ERROR otherwise */ wwd_result_t host_rtos_finish_thread( host_thread_type_t* thread ) { UINT status; status = tx_thread_terminate( thread ); return ( status == TX_SUCCESS ) ? WWD_SUCCESS : WWD_THREAD_FINISH_FAIL; }