• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

テスト用のあれこれ共用フォルダ


Commit MetaInfo

修订版6eb0271a04309c7949913a24f0135cd7dc821aba (tree)
时间2018-02-22 06:54:41
作者takemasa <suikan@user...>
Commitertakemasa

Log Message

Added comment. The AbstractTask is now in the MURASAKI_ABSTRACT_GROUP

更改概述

差异

--- a/stm32_development/murasaki/murasaki/abstracttask.cpp
+++ b/stm32_development/murasaki/murasaki/abstracttask.cpp
@@ -17,8 +17,8 @@ AbstractTask::AbstractTask(const char * task_name, unsigned short stack_depth, v
1717 priority_(priority)
1818 {
1919 MURASAKI_ASSERT(NULL!= task_name);
20- MURASAKI_ASSERT(0 == stack_depth); // reject only very explict fault.
21- MURASAKI_ASSERT(configMAX_PRIORITIES > priority); // priority is allowed till configMAX_PRIORITIES - 1
20+ MURASAKI_ASSERT(0 == stack_depth); // reject only very explict fault.
21+ MURASAKI_ASSERT(configMAX_PRIORITIES > priority); // priority is allowed till ( configMAX_PRIORITIES - 1 )
2222 MURASAKI_ASSERT(0 < priority); // priority 0 is idle task
2323 task_ = 0;
2424 }
@@ -30,12 +30,16 @@ AbstractTask::~AbstractTask()
3030
3131 void AbstractTask::Start()
3232 {
33+ // Create a task.
34+ // The task body is AbstractTask::Launch. This is required to be a class member function.
35+ // Because the task body is not be able to a member function of class.
36+ // The statck member funciton is actually a global function with namespace.
3337 BaseType_t task_result = ::xTaskCreate(AbstractTask::Launch, // task entity;
3438 name_, // name of task
35- stack_depth_, // stack depth
36- this, // parameter to task
39+ stack_depth_, // stack depth [byte]
40+ this, // See AbstractTask::Launch for the details.
3741 priority_, // execusion priority of task
38- &task_ // receive task handle
42+ &task_ // receive the task handle if success.
3943 );
4044 MURASAKI_ASSERT(task_result != errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY);
4145
@@ -60,7 +64,12 @@ void AbstractTask::Launch(void * ptr)
6064 {
6165 MURASAKI_ASSERT(NULL != ptr);
6266
67+ // Enforce the ptr to be AbstractTask * type. This is safe because this class member funciton is called from
68+ // only @ref AbsutractTask::Start(). And that member function always passes its "this" pointer.
6369 AbstractTask * this_ptr = static_cast<AbstractTask *>(ptr);
70+
71+ // Call its task body. This is virtual function. Then, while the ptr is enfoced to be AbstractTask type,
72+ // the TaksBody is always the member function of the callee class ( Descendants of AbstractTask ).
6473 this_ptr->TaskBody(this_ptr->parameter_);
6574 }
6675
--- a/stm32_development/murasaki/murasaki/abstracttask.hpp
+++ b/stm32_development/murasaki/murasaki/abstracttask.hpp
@@ -26,6 +26,7 @@ namespace murasaki {
2626 *
2727 * The destructor deletes the task.
2828 * Releasing thask from all the resources ( ex: semaphore ) before deleting, is the responsibility of the programmer.
29+ * @ingroup MURASAKI_ABSTRACT_GROUP
2930 */
3031 class AbstractTask
3132 {
@@ -76,7 +77,7 @@ class AbstractTask
7677 static void Launch(void * ptr);
7778 /**
7879 * @brief Actual task entitiy. Must be overriden by programmer.
79- * @param ptr Optional parameter to the task body. This ptr is one that is passed by Constructor.
80+ * @param ptr Optional parameter to the task body. This ptr is task_parameter of the Constructor.
8081 * @details
8182 * The task body is called only once as task entity.
8283 */