classtk_1_1_semaphore.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <?xml version='1.0' encoding='UTF-8' standalone='no'?>
  2. <doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.18.0" xml:lang="ja">
  3. <compounddef id="classtk_1_1_semaphore" kind="class" language="C++" prot="public">
  4. <compoundname>tk::Semaphore</compoundname>
  5. <includes refid="sync_8hpp" local="no">sync.hpp</includes>
  6. <sectiondef kind="private-attrib">
  7. <memberdef kind="variable" id="classtk_1_1_semaphore_1a1cb192b9e595a70263818f83c6086e06" prot="private" static="no" mutable="no">
  8. <type>int32_t</type>
  9. <definition>int32_t tk::Semaphore::count_</definition>
  10. <argsstring></argsstring>
  11. <name>count_</name>
  12. <qualifiedname>tk::Semaphore::count_</qualifiedname>
  13. <briefdescription>
  14. </briefdescription>
  15. <detaileddescription>
  16. </detaileddescription>
  17. <inbodydescription>
  18. </inbodydescription>
  19. <location file="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" line="97" column="13" bodyfile="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" bodystart="97" bodyend="-1"/>
  20. </memberdef>
  21. <memberdef kind="variable" id="classtk_1_1_semaphore_1a3f2fbcd57ad374cfa458f2214053a230" prot="private" static="no" mutable="no">
  22. <type>int32_t</type>
  23. <definition>int32_t tk::Semaphore::max_count_</definition>
  24. <argsstring></argsstring>
  25. <name>max_count_</name>
  26. <qualifiedname>tk::Semaphore::max_count_</qualifiedname>
  27. <briefdescription>
  28. </briefdescription>
  29. <detaileddescription>
  30. </detaileddescription>
  31. <inbodydescription>
  32. </inbodydescription>
  33. <location file="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" line="98" column="13" bodyfile="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" bodystart="98" bodyend="-1"/>
  34. </memberdef>
  35. <memberdef kind="variable" id="classtk_1_1_semaphore_1a2133460c0c6607a86406fc7ac8dd4c3b" prot="private" static="no" mutable="no">
  36. <type><ref refid="namespacetk_1add371a241ec6c1695ef4e67935317edd" kindref="member">task_mask_t</ref></type>
  37. <definition>task_mask_t tk::Semaphore::wait_mask_</definition>
  38. <argsstring></argsstring>
  39. <name>wait_mask_</name>
  40. <qualifiedname>tk::Semaphore::wait_mask_</qualifiedname>
  41. <initializer>{0}</initializer>
  42. <briefdescription>
  43. </briefdescription>
  44. <detaileddescription>
  45. </detaileddescription>
  46. <inbodydescription>
  47. </inbodydescription>
  48. <location file="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" line="99" column="17" bodyfile="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" bodystart="99" bodyend="99"/>
  49. </memberdef>
  50. </sectiondef>
  51. <sectiondef kind="public-func">
  52. <memberdef kind="function" id="classtk_1_1_semaphore_1a66c5ac90338a6fcc6a9c2f22f1586de8" prot="public" static="no" const="no" explicit="yes" inline="yes" virt="non-virtual">
  53. <type></type>
  54. <definition>tk::Semaphore::Semaphore</definition>
  55. <argsstring>(int32_t initial_count=1, int32_t max_count=1)</argsstring>
  56. <name>Semaphore</name>
  57. <qualifiedname>tk::Semaphore::Semaphore</qualifiedname>
  58. <param>
  59. <type>int32_t</type>
  60. <declname>initial_count</declname>
  61. <defval>1</defval>
  62. </param>
  63. <param>
  64. <type>int32_t</type>
  65. <declname>max_count</declname>
  66. <defval>1</defval>
  67. </param>
  68. <briefdescription>
  69. <para>セマフォを初期化します </para>
  70. </briefdescription>
  71. <detaileddescription>
  72. <para><parameterlist kind="param"><parameteritem>
  73. <parameternamelist>
  74. <parametername>initial_count</parametername>
  75. </parameternamelist>
  76. <parameterdescription>
  77. <para>初期資源カウント (省略時: 1) </para>
  78. </parameterdescription>
  79. </parameteritem>
  80. <parameteritem>
  81. <parameternamelist>
  82. <parametername>max_count</parametername>
  83. </parameternamelist>
  84. <parameterdescription>
  85. <para>最大資源カウント (省略時: 1) </para>
  86. </parameterdescription>
  87. </parameteritem>
  88. </parameterlist>
  89. </para>
  90. </detaileddescription>
  91. <inbodydescription>
  92. </inbodydescription>
  93. <location file="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" line="31" column="14" bodyfile="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" bodystart="31" bodyend="32"/>
  94. </memberdef>
  95. <memberdef kind="function" id="classtk_1_1_semaphore_1a863ccee07bc701a78342c14503955d73" prot="public" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
  96. <type>void</type>
  97. <definition>void tk::Semaphore::acquire</definition>
  98. <argsstring>()</argsstring>
  99. <name>acquire</name>
  100. <qualifiedname>tk::Semaphore::acquire</qualifiedname>
  101. <briefdescription>
  102. <para>資源を獲得するまで現在のタスクをブロックします </para>
  103. </briefdescription>
  104. <detaileddescription>
  105. <para>資源カウントが 0 以下の場合はタスクが休止状態になり、CPU は他タスクへ譲渡されます (CPU消費ゼロ)。 </para>
  106. </detaileddescription>
  107. <inbodydescription>
  108. </inbodydescription>
  109. <location file="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" line="39" column="10" bodyfile="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" bodystart="39" bodyend="51"/>
  110. </memberdef>
  111. <memberdef kind="function" id="classtk_1_1_semaphore_1a3a246c8afc866dc438186d0a53cad5c2" prot="public" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
  112. <type>bool</type>
  113. <definition>bool tk::Semaphore::try_acquire</definition>
  114. <argsstring>()</argsstring>
  115. <name>try_acquire</name>
  116. <qualifiedname>tk::Semaphore::try_acquire</qualifiedname>
  117. <briefdescription>
  118. <para>資源の獲得を試みます (ノンブロッキング) </para>
  119. </briefdescription>
  120. <detaileddescription>
  121. <para><simplesect kind="return"><para>true 獲得成功 (カウントが 1 減算された) </para>
  122. </simplesect>
  123. <simplesect kind="return"><para>false 資源がないため獲得失敗 (ブロックせず即座に復帰) </para>
  124. </simplesect>
  125. </para>
  126. </detaileddescription>
  127. <inbodydescription>
  128. </inbodydescription>
  129. <location file="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" line="59" column="10" bodyfile="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" bodystart="59" bodyend="68"/>
  130. </memberdef>
  131. <memberdef kind="function" id="classtk_1_1_semaphore_1a7bb8eb8b0bd69b2f6b0a4d89d0f5b07b" prot="public" static="no" const="no" explicit="no" inline="yes" virt="non-virtual">
  132. <type>void</type>
  133. <definition>void tk::Semaphore::release</definition>
  134. <argsstring>()</argsstring>
  135. <name>release</name>
  136. <qualifiedname>tk::Semaphore::release</qualifiedname>
  137. <briefdescription>
  138. <para>資源を返却し、待機中タスクがあれば最優先度のタスクを 1 つ起床させます </para>
  139. </briefdescription>
  140. <detaileddescription>
  141. </detaileddescription>
  142. <inbodydescription>
  143. </inbodydescription>
  144. <location file="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" line="73" column="10" bodyfile="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" bodystart="73" bodyend="86"/>
  145. </memberdef>
  146. <memberdef kind="function" id="classtk_1_1_semaphore_1ae53b9c57cc25fafb242a21776f112701" prot="public" static="no" const="yes" explicit="no" inline="yes" virt="non-virtual">
  147. <type>int32_t</type>
  148. <definition>int32_t tk::Semaphore::count</definition>
  149. <argsstring>() const</argsstring>
  150. <name>count</name>
  151. <qualifiedname>tk::Semaphore::count</qualifiedname>
  152. <briefdescription>
  153. </briefdescription>
  154. <detaileddescription>
  155. <para>現在の資源カウントを取得 </para>
  156. </detaileddescription>
  157. <inbodydescription>
  158. </inbodydescription>
  159. <location file="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" line="89" column="13" bodyfile="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" bodystart="89" bodyend="94"/>
  160. </memberdef>
  161. </sectiondef>
  162. <briefdescription>
  163. <para>計数セマフォ (Counting <ref refid="classtk_1_1_semaphore" kindref="compound">Semaphore</ref>) / バイナリセマフォ </para>
  164. </briefdescription>
  165. <detaileddescription>
  166. <para>資源の獲得・返却によるタスク間同期を行います。資源がない場合はタスクが <computeroutput>State::Blocked</computeroutput> に遷移して休止し、返却時に優先度の高いタスクから順に起床します。</para>
  167. <para><programlisting><codeline><highlight class="normal">tk::Semaphore<sp/>sem(0,<sp/>5);<sp/></highlight><highlight class="comment">//<sp/>初期値0、最大5</highlight><highlight class="normal"></highlight></codeline>
  168. <codeline><highlight class="normal"></highlight></codeline>
  169. <codeline><highlight class="normal"></highlight><highlight class="comment">//<sp/>タスク側<sp/>(資源が空くまでブロック待機)</highlight><highlight class="normal"></highlight></codeline>
  170. <codeline><highlight class="normal">sem.acquire();</highlight></codeline>
  171. <codeline><highlight class="normal"></highlight></codeline>
  172. <codeline><highlight class="normal"></highlight><highlight class="comment">//<sp/>シグナル送信側<sp/>(割り込みや他タスクから返却・通知)</highlight><highlight class="normal"></highlight></codeline>
  173. <codeline><highlight class="normal">sem.release();</highlight></codeline>
  174. </programlisting> </para>
  175. </detaileddescription>
  176. <location file="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" line="24" column="1" bodyfile="C:/Users/yoneda/Documents/Pico_Projects/tinykernel/tinykernel/include/tinykernel/sync.hpp" bodystart="24" bodyend="100"/>
  177. <listofallmembers>
  178. <member refid="classtk_1_1_semaphore_1a863ccee07bc701a78342c14503955d73" prot="public" virt="non-virtual"><scope>tk::Semaphore</scope><name>acquire</name></member>
  179. <member refid="classtk_1_1_semaphore_1ae53b9c57cc25fafb242a21776f112701" prot="public" virt="non-virtual"><scope>tk::Semaphore</scope><name>count</name></member>
  180. <member refid="classtk_1_1_semaphore_1a1cb192b9e595a70263818f83c6086e06" prot="private" virt="non-virtual"><scope>tk::Semaphore</scope><name>count_</name></member>
  181. <member refid="classtk_1_1_semaphore_1a3f2fbcd57ad374cfa458f2214053a230" prot="private" virt="non-virtual"><scope>tk::Semaphore</scope><name>max_count_</name></member>
  182. <member refid="classtk_1_1_semaphore_1a7bb8eb8b0bd69b2f6b0a4d89d0f5b07b" prot="public" virt="non-virtual"><scope>tk::Semaphore</scope><name>release</name></member>
  183. <member refid="classtk_1_1_semaphore_1a66c5ac90338a6fcc6a9c2f22f1586de8" prot="public" virt="non-virtual"><scope>tk::Semaphore</scope><name>Semaphore</name></member>
  184. <member refid="classtk_1_1_semaphore_1a3a246c8afc866dc438186d0a53cad5c2" prot="public" virt="non-virtual"><scope>tk::Semaphore</scope><name>try_acquire</name></member>
  185. <member refid="classtk_1_1_semaphore_1a2133460c0c6607a86406fc7ac8dd4c3b" prot="private" virt="non-virtual"><scope>tk::Semaphore</scope><name>wait_mask_</name></member>
  186. </listofallmembers>
  187. </compounddef>
  188. </doxygen>