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 ) ); }
wiced_result_t wiced_rtos_create_thread_with_stack( wiced_thread_t* thread, uint8_t priority, const char* name, wiced_thread_function_t function, void* stack, uint32_t stack_size, void* arg ) { wiced_result_t result; memset(thread, 0, sizeof(wiced_thread_t)); result = (wiced_result_t) host_rtos_create_thread_with_arg( WICED_GET_THREAD_HANDLE( thread ), function, name, stack, stack_size, priority, (uint32_t)arg ); return result; }
wiced_result_t wiced_rtos_create_thread( wiced_thread_t* thread, uint8_t priority, const char* name, wiced_thread_function_t function, uint32_t stack_size, void* arg ) { /* Limit priority to default lib priority */ if ( priority > RTOS_HIGHEST_PRIORITY ) { priority = RTOS_HIGHEST_PRIORITY; } return host_rtos_create_thread_with_arg( WICED_GET_THREAD_HANDLE( thread ), function, name, NULL, stack_size, WICED_PRIORITY_TO_NATIVE_PRIORITY( priority ), (uint32_t) arg ); }
wiced_result_t wiced_rtos_create_thread( wiced_thread_t* thread, uint8_t priority, const char* name, wiced_thread_function_t function, uint32_t stack_size, void* arg ) { wiced_result_t result; thread->stack = malloc_named( "stack", stack_size ); if (thread->stack == NULL) { return WICED_OUT_OF_HEAP_SPACE; } malloc_transfer_to_curr_thread( thread->stack ); result = (wiced_result_t) host_rtos_create_thread_with_arg( WICED_GET_THREAD_HANDLE( thread ), function, name, thread->stack, stack_size, priority, (uint32_t)arg ); if ( result != WICED_WWD_SUCCESS ) { free( thread->stack ); thread->stack = NULL; } return result; }
wiced_result_t wiced_rtos_thread_join( wiced_thread_t* thread ) { return host_rtos_join_thread( WICED_GET_THREAD_HANDLE( thread ) ); }