wiced_result_t wiced_rtos_delete_thread( wiced_thread_t* thread ) { wiced_result_t result = (wiced_result_t) host_rtos_finish_thread( WICED_GET_THREAD_HANDLE( thread ) ); if ( result != WICED_WWD_SUCCESS ) { return result; } if ( thread->stack != NULL ) { malloc_transfer_to_curr_thread( thread->stack ); } malloc_leak_check( &thread->handle, LEAK_CHECK_THREAD ); result = (wiced_result_t) host_rtos_delete_terminated_thread( WICED_GET_THREAD_HANDLE( thread ) ); if ( result == WICED_WWD_SUCCESS ) { if ( thread->stack != NULL ) { free( thread->stack ); thread->stack = NULL; } } return result; }
wiced_result_t wiced_rtos_delete_thread(wiced_thread_t* thread) { wiced_result_t result; malloc_leak_check( &thread, LEAK_CHECK_THREAD ); result = host_rtos_finish_thread( WICED_GET_THREAD_HANDLE( thread ) ); if ( result != WICED_WWD_SUCCESS ) { return result; } return host_rtos_delete_terminated_thread( WICED_GET_THREAD_HANDLE( thread ) ); }
/** Terminates the WWD Thread * * Sets a flag then wakes the WWD Thread to force it to terminate. * */ void wwd_thread_quit( void ) { wwd_result_t result; /* signal main thread and wake it */ wwd_thread_quit_flag = WICED_TRUE; result = host_rtos_set_semaphore( &wwd_transceive_semaphore, WICED_FALSE ); if ( result == WWD_SUCCESS ) { /* Wait for the WWD thread to end */ host_rtos_join_thread( &wwd_thread ); (void) host_rtos_delete_terminated_thread( &wwd_thread ); /* Ignore return - not much can be done about failure */ } }
besl_result_t besl_p2p_deinit( p2p_workspace_t* workspace ) { /* Stop and delete the P2P thread */ besl_p2p_stop(workspace); host_rtos_join_thread(&p2p_thread); host_rtos_delete_terminated_thread(&p2p_thread); memset(&p2p_thread, 0, sizeof(p2p_thread)); /* Delete the message queue */ host_rtos_deinit_queue( &p2p_message_queue ); /* Delete the pending outgoing packet queue */ host_rtos_deinit_queue( &p2p_outgoing_packet_queue ); return BESL_SUCCESS; }