Skip to content

Commit 202b233

Browse files
committed
[update] thread.c api annotation.
1 parent 48c7a45 commit 202b233

File tree

1 file changed

+70
-68
lines changed

1 file changed

+70
-68
lines changed

src/thread.c

Lines changed: 70 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ static void (*rt_thread_inited_hook) (rt_thread_t thread);
4040
/**
4141
* @brief This function sets a hook function when the system suspend a thread.
4242
*
43-
* @note the hook function must be simple and never be blocked or suspend.
43+
* @note The hook function must be simple and never be blocked or suspend.
4444
*
45-
* @param hook the specified hook function.
45+
* @param hook is the specified hook function.
4646
*/
4747
void rt_thread_suspend_sethook(void (*hook)(rt_thread_t thread))
4848
{
@@ -52,9 +52,9 @@ void rt_thread_suspend_sethook(void (*hook)(rt_thread_t thread))
5252
/**
5353
* @brief This function sets a hook function when the system resume a thread.
5454
*
55-
* @note the hook function must be simple and never be blocked or suspend.
55+
* @note The hook function must be simple and never be blocked or suspend.
5656
*
57-
* @param hook the specified hook function.
57+
* @param hook is the specified hook function.
5858
*/
5959
void rt_thread_resume_sethook(void (*hook)(rt_thread_t thread))
6060
{
@@ -64,7 +64,7 @@ void rt_thread_resume_sethook(void (*hook)(rt_thread_t thread))
6464
/**
6565
* @brief This function sets a hook function when a thread is initialized.
6666
*
67-
* @param hook the specified hook function.
67+
* @param hook is the specified hook function.
6868
*/
6969
void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread))
7070
{
@@ -240,27 +240,27 @@ static rt_err_t _thread_init(struct rt_thread *thread,
240240
/**@{*/
241241

242242
/**
243-
* @brief This function will initialize a thread, normally it's used to initialize a
243+
* @brief This function will initialize a thread. It's used to initialize a
244244
* static thread object.
245245
*
246-
* @param thread the static thread object.
246+
* @param thread is the static thread object.
247247
*
248-
* @param name the name of thread, which shall be unique.
248+
* @param name is the name of thread, which shall be unique.
249249
*
250-
* @param entry the entry function of thread.
250+
* @param entry is the entry function of thread.
251251
*
252-
* @param parameter the parameter of thread enter function.
252+
* @param parameter is the parameter of thread enter function.
253253
*
254-
* @param stack_start the start address of thread stack.
254+
* @param stack_start is the start address of thread stack.
255255
*
256-
* @param stack_size the size of thread stack.
256+
* @param stack_size is the size of thread stack.
257257
*
258-
* @param priority the priority of thread.
258+
* @param priority is the priority of thread.
259259
*
260-
* @param tick the time slice if there are same priority thread.
260+
* @param tick is the time slice if there are same priority thread.
261261
*
262-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
263-
* When the return value is any other values, it means this operation failed.
262+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
263+
* If the return value is any other values, it means this operation failed.
264264
*/
265265
rt_err_t rt_thread_init(struct rt_thread *thread,
266266
const char *name,
@@ -292,7 +292,7 @@ RTM_EXPORT(rt_thread_init);
292292
/**
293293
* @brief This function will return self thread object.
294294
*
295-
* @return the self thread object.
295+
* @return The self thread object.
296296
*/
297297
rt_thread_t rt_thread_self(void)
298298
{
@@ -315,10 +315,10 @@ RTM_EXPORT(rt_thread_self);
315315
/**
316316
* @brief This function will start a thread and put it to system ready queue.
317317
*
318-
* @param thread the thread to be started.
318+
* @param thread is the thread to be started.
319319
*
320-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
321-
* When the return value is any other values, it means this operation failed.
320+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
321+
* If the return value is any other values, it means this operation failed.
322322
*/
323323
rt_err_t rt_thread_startup(rt_thread_t thread)
324324
{
@@ -357,12 +357,12 @@ RTM_EXPORT(rt_thread_startup);
357357

358358
/**
359359
* @brief This function will detach a thread. The thread object will be removed from
360-
* thread queue and detached/deleted from system object management.
360+
* thread queue and detached/deleted from the system object management.
361361
*
362-
* @param thread the thread to be deleted.
362+
* @param thread is the thread to be deleted.
363363
*
364-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
365-
* When the return value is any other values, it means this operation failed.
364+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
365+
* If the return value is any other values, it means this operation failed.
366366
*/
367367
rt_err_t rt_thread_detach(rt_thread_t thread)
368368
{
@@ -413,19 +413,20 @@ RTM_EXPORT(rt_thread_detach);
413413
* @brief This function will create a thread object and allocate thread object memory.
414414
* and stack.
415415
*
416-
* @param name the name of thread, which shall be unique.
416+
* @param name is the name of thread, which shall be unique.
417417
*
418-
* @param entry the entry function of thread.
418+
* @param entry is the entry function of thread.
419419
*
420-
* @param parameter the parameter of thread enter function.
420+
* @param parameter is the parameter of thread enter function.
421421
*
422-
* @param stack_size the size of thread stack.
422+
* @param stack_size is the size of thread stack.
423423
*
424-
* @param priority the priority of thread.
424+
* @param priority is the priority of thread.
425425
*
426-
* @param tick the time slice if there are same priority thread.
426+
* @param tick is the time slice if there are same priority thread.
427427
*
428-
* @return the created thread object.
428+
* @return If the return value is a rt_thread structure pointer, the function is successfully executed.
429+
* If the return value is RT_NULL, it means this operation failed.
429430
*/
430431
rt_thread_t rt_thread_create(const char *name,
431432
void (*entry)(void *parameter),
@@ -468,10 +469,10 @@ RTM_EXPORT(rt_thread_create);
468469
* @brief This function will delete a thread. The thread object will be removed from
469470
* thread queue and deleted from system object management in the idle thread.
470471
*
471-
* @param thread the thread to be deleted.
472+
* @param thread is the thread to be deleted.
472473
*
473-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
474-
* When the return value is any other values, it means this operation failed.
474+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
475+
* If the return value is any other values, it means this operation failed.
475476
*/
476477
rt_err_t rt_thread_delete(rt_thread_t thread)
477478
{
@@ -514,12 +515,12 @@ RTM_EXPORT(rt_thread_delete);
514515
#endif /* RT_USING_HEAP */
515516

516517
/**
517-
* @brief This function will let current thread yield processor, and scheduler will
518-
* choose a highest thread to run. After yield processor, the current thread
519-
* is still in READY state.
518+
* @brief This function will let current thread yield processor, and scheduler will
519+
* choose the highest thread to run. After yield processor, the current thread
520+
* is still in READY state.
520521
*
521-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
522-
* When the return value is any other values, it means this operation failed.
522+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
523+
* If the return value is any other values, it means this operation failed.
523524
*/
524525
rt_err_t rt_thread_yield(void)
525526
{
@@ -541,10 +542,10 @@ RTM_EXPORT(rt_thread_yield);
541542
* @brief This function will let current thread sleep for some ticks. Change current thread state to suspend,
542543
* when the thread timer reaches the tick value, scheduler will awaken this thread.
543544
*
544-
* @param tick the sleep ticks.
545+
* @param tick is the sleep ticks.
545546
*
546-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
547-
* When the return value is any other values, it means this operation failed.
547+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
548+
* If the return value is any other values, it means this operation failed.
548549
*/
549550
rt_err_t rt_thread_sleep(rt_tick_t tick)
550551
{
@@ -581,10 +582,10 @@ rt_err_t rt_thread_sleep(rt_tick_t tick)
581582
/**
582583
* @brief This function will let current thread delay for some ticks.
583584
*
584-
* @param tick the delay ticks.
585+
* @param tick is the delay ticks.
585586
*
586-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
587-
* When the return value is any other values, it means this operation failed.
587+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
588+
* If the return value is any other values, it means this operation failed.
588589
*/
589590
rt_err_t rt_thread_delay(rt_tick_t tick)
590591
{
@@ -595,12 +596,12 @@ RTM_EXPORT(rt_thread_delay);
595596
/**
596597
* @brief This function will let current thread delay until (*tick + inc_tick).
597598
*
598-
* @param tick the tick of last wakeup.
599+
* @param tick is the tick of last wakeup.
599600
*
600-
* @param inc_tick the increment tick.
601+
* @param inc_tick is the increment tick.
601602
*
602-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
603-
* When the return value is any other values, it means this operation failed.
603+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
604+
* If the return value is any other values, it means this operation failed.
604605
*/
605606
rt_err_t rt_thread_delay_until(rt_tick_t *tick, rt_tick_t inc_tick)
606607
{
@@ -657,10 +658,10 @@ RTM_EXPORT(rt_thread_delay_until);
657658
/**
658659
* @brief This function will let current thread delay for some milliseconds.
659660
*
660-
* @param ms the delay ms time.
661+
* @param ms is the delay ms time.
661662
*
662-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
663-
* When the return value is any other values, it means this operation failed.
663+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
664+
* If the return value is any other values, it means this operation failed.
664665
*/
665666
rt_err_t rt_thread_mdelay(rt_int32_t ms)
666667
{
@@ -675,9 +676,9 @@ RTM_EXPORT(rt_thread_mdelay);
675676
/**
676677
* @brief This function will control thread behaviors according to control command.
677678
*
678-
* @param thread the specified thread to be controlled.
679+
* @param thread is the specified thread to be controlled.
679680
*
680-
* @param cmd the control command, which includes.
681+
* @param cmd is the control command, which includes.
681682
*
682683
* RT_THREAD_CTRL_CHANGE_PRIORITY for changing priority level of thread.
683684
*
@@ -687,10 +688,10 @@ RTM_EXPORT(rt_thread_mdelay);
687688
*
688689
* RT_THREAD_CTRL_BIND_CPU for bind the thread to a CPU.
689690
*
690-
* @param arg the argument of control command.
691+
* @param arg is the argument of control command.
691692
*
692-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
693-
* When the return value is any other values, it means this operation failed.
693+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
694+
* If the return value is any other values, it means this operation failed.
694695
*/
695696
rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg)
696697
{
@@ -798,13 +799,13 @@ RTM_EXPORT(rt_thread_control);
798799
/**
799800
* @brief This function will suspend the specified thread and change it to suspend state.
800801
*
801-
* @note if suspend self thread, after this function call, the
802+
* @note If suspend self thread, after this function call, the
802803
* rt_schedule() must be invoked.
803804
*
804-
* @param thread the thread to be suspended.
805+
* @param thread is the thread to be suspended.
805806
*
806-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
807-
* When the return value is any other values, it means this operation failed.
807+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
808+
* If the return value is any other values, it means this operation failed.
808809
*/
809810
rt_err_t rt_thread_suspend(rt_thread_t thread)
810811
{
@@ -851,10 +852,10 @@ RTM_EXPORT(rt_thread_suspend);
851852
/**
852853
* @brief This function will resume a thread and put it to system ready queue.
853854
*
854-
* @param thread the thread to be resumed.
855+
* @param thread is the thread to be resumed.
855856
*
856-
* @return Return the operation status. When the return value is RT_EOK, the function is successfully executed.
857-
* When the return value is any other values, it means this operation failed.
857+
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
858+
* If the return value is any other values, it means this operation failed.
858859
*/
859860
rt_err_t rt_thread_resume(rt_thread_t thread)
860861
{
@@ -897,7 +898,7 @@ RTM_EXPORT(rt_thread_resume);
897898
* @brief This function is the timeout function for thread, normally which is invoked
898899
* when thread is timeout to wait some resource.
899900
*
900-
* @param parameter the parameter of thread timeout function
901+
* @param parameter is the parameter of thread timeout function
901902
*/
902903
void rt_thread_timeout(void *parameter)
903904
{
@@ -934,11 +935,12 @@ RTM_EXPORT(rt_thread_timeout);
934935
/**
935936
* @brief This function will find the specified thread.
936937
*
937-
* @note please don't invoke this function in interrupt status.
938+
* @note Please don't invoke this function in interrupt status.
938939
*
939-
* @param name the name of thread finding.
940+
* @param name is the name of thread finding.
940941
*
941-
* @return the found thread.
942+
* @return If the return value is a rt_thread structure pointer, the function is successfully executed.
943+
* If the return value is RT_NULL, it means this operation failed.
942944
*/
943945
rt_thread_t rt_thread_find(char *name)
944946
{

0 commit comments

Comments
 (0)