MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_thread_init

Function rt_thread_init

src/thread.c:339–367  ·  view source on GitHub ↗

* @brief This function will initialize a thread. It's used to initialize a * static thread object. * * @param thread Thread handle. Thread handle is provided by the user and * points to the corresponding thread control block memory address. * * @param name Name of the thread (shall be unique); the maximum length of the * thread name is specified

Source from the content-addressed store, hash-verified

337 * If the return value is any other values, it means this operation failed.
338 */
339rt_err_t rt_thread_init(struct rt_thread *thread,
340 const char *name,
341 void (*entry)(void *parameter),
342 void *parameter,
343 void *stack_start,
344 rt_uint32_t stack_size,
345 rt_uint8_t priority,
346 rt_uint32_t tick)
347{
348 /* parameter check */
349 RT_ASSERT(thread != RT_NULL);
350 RT_ASSERT(stack_start != RT_NULL);
351 RT_ASSERT(tick != 0);
352
353 /* clean memory data of thread */
354 rt_memset(thread, 0x0, sizeof(struct rt_thread));
355
356 /* initialize thread object */
357 rt_object_init((rt_object_t)thread, RT_Object_Class_Thread, name);
358
359 return _thread_init(thread,
360 name,
361 entry,
362 parameter,
363 stack_start,
364 stack_size,
365 priority,
366 tick);
367}
368RTM_EXPORT(rt_thread_init);
369
370/**

Callers 15

finsh_system_initFunction · 0.85
rt_usbd_core_initFunction · 0.85
rt_usb_vcom_initFunction · 0.85
rt_usb_hid_initFunction · 0.85
rt_mmcsd_core_initFunction · 0.85
rt_vbus_initFunction · 0.85
pthread_createFunction · 0.85
mainFunction · 0.85
rt_application_initFunction · 0.85
rt_application_initFunction · 0.85
rt_application_initFunction · 0.85

Calls 3

rt_memsetFunction · 0.85
rt_object_initFunction · 0.85
_thread_initFunction · 0.85

Tested by 6

test_cpusmpFunction · 0.68
demo_core_testFunction · 0.68
test_static_threadFunction · 0.68