<pre>\r
#include <stdio.h>\r
#include "SDL_thread.h"\r
-#include "SDL_timer.h"\r
\r
-int TestThread(void *ptr);\r
+/* \82Æ\82Ä\82à\92P\8f\83\82È\83X\83\8c\83b\83h - 50ms\8aÔ\8au\82Å0\82©\82ç9\82Ü\82Å\83J\83E\83\93\83g\82·\82é */\r
+static int TestThread(void *ptr)\r
+{\r
+ int cnt;\r
+\r
+ for (cnt = 0; cnt < 10; ++cnt) {\r
+ SDL_Log("\83X\83\8c\83b\83h\83J\83E\83\93\83^: %d\n", cnt);\r
+ SDL_Delay(50);\r
+ }\r
+\r
+ return cnt;\r
+}\r
\r
int main(int argc, char *argv[])\r
{\r
- SDL_Thread *thread;\r
- SDL_threadID threadID;\r
- int threadReturnValue;\r
+ SDL_Thread *thread;\r
+ int threadReturnValue;\r
\r
- printf("\n\8aÈ\92P\82ÈSDL_CreateThread\82Ì\83e\83X\83g:");\r
+ SDL_Log("\92P\8f\83\82ÈSDL_CreateThread\82Ì\83e\83X\83g:\n");\r
\r
- // \92P\82É\83X\83\8c\83b\83h\82ð\90¶\90¬\82·\82é\r
+ /* \92P\82É\83X\83\8c\83b\83h\82ð\90¶\90¬\82·\82é */\r
thread = SDL_CreateThread(TestThread, "TestThread", (void *)NULL);\r
\r
if (NULL == thread) {\r
- printf("\nSDL_CreateThread \8e¸\94s: %s\n", SDL_GetError());\r
- exit(-1);\r
+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_CreateThread \8e¸\94s: %s\n", SDL_GetError());\r
+ } else {\r
+ SDL_WaitThread(thread, &threadReturnValue);\r
+ SDL_Log("\83X\83\8c\83b\83h\82Ì\96ß\82è\92l: %d\n", threadReturnValue);\r
}\r
\r
- // \90V\82µ\82\8aJ\8en\82³\82ê\82½\83X\83\8c\83b\83h\82ÌID\82ð\93¾\82é\r
- threadID = SDL_GetThreadID(thread);\r
-\r
- // \83X\83\8c\83b\83h\82Ì\8a®\97¹\82ð\91Ò\82¿\96ß\82è\92l\82ð\93¾\82é\r
- SDL_WaitThread(thread, &threadReturnValue);\r
- printf("\n\83X\83\8c\83b\83h\82Ì\96ß\82è\92l: %d", threadReturnValue);\r
-\r
return 0;\r
}\r
-\r
-// \82Æ\82Ä\82à\8aÈ\92P\82È\83X\83\8c\83b\83h - 50ms\8aÔ\8au\82Å0\82©\82ç9\82Ü\82Å\83J\83E\83\93\83g\82·\82é\r
-int TestThread(void *ptr)\r
-{\r
- int cnt;\r
-\r
- for (cnt = 0; cnt < 10; ++cnt) {\r
- printf("\n\83X\83\8c\83b\83h\83J\83E\83\93\83^: %d", cnt);\r
- SDL_Delay(50);\r
- }\r
-\r
- return cnt;\r
-}\r
</pre>\r
</code>\r
</p>\r
</p>\r
<h2>\8fÚ\8d×</h2>\r
<p>\r
-<a href="SDL_CreateThread.html">SDL_CreateThread()</a>\82Í, \83O\83\8d\81[\83o\83\8b\83\81\83\82\83\8a, \83V\83O\83i\83\8b\83n\83\93\83h\83\89, \83t\83@\83C\83\8b\83f\83B\83X\83N\83\8a\83v\83^\93\99\82Ì\91S\82Ä\82ð\90e\82Æ\8b¤\97L\82·\82é\90V\82µ\82¢\83X\83\8c\83b\83h\82ð\90¶\90¬\82µ, \8aÖ\90\94fn\82Évoid\83|\83C\83\93\83^\82Ìdata\82ð\93n\82µ\8eÀ\8ds\82·\82é.\r
-\8aÖ\90\94fn\82©\82ç\96ß\82é\82Æ\83X\83\8c\83b\83h\82Í\8fI\97¹\82·\82é.\r
+\82±\82ê\82Í\8e\9f\82Ì\8cÄ\82Ñ\8fo\82µ\82Æ\93\99\89¿\82Å\82 \82é:\r
</p>\r
<p>\r
-fn\82Ì\8aÖ\90\94\83v\83\8d\83g\83^\83C\83v\82Í\r
-</p>\r
-<p>\r
-<code>int SDL_ThreadFunction(void* data)</code>\r
-</p>\r
-<p>\r
-\88ø\90\94\82Í\r
-<table border="1" summary="fn">\r
-<tr><td>data</td><td><a href="SDL_CreateThread.html">SDL_CreateThread()</a>\82É\93n\82µ\82½data</td></tr>\r
-</table>\r
-</p>\r
-<p>\r
-\83X\83\8c\83b\83h\82Ì\96¼\91O\82ÍNUL\95¶\8e\9a\82Å\8fI\82í\82éUTF-8\95¶\8e\9a\97ñ\82Å\82 \82ê\82Î\89½\82Å\82à\82æ\82¢\82ª, \8e\9f\82Ì\8ew\90j\82ª\96ð\97§\82Â\82©\82à\82µ\82ê\82È\82¢.\r
-</p>\r
-<p>\r
-<a href="http://stackoverflow.com/questions/149932/naming-conventions-for-threads">http://stackoverflow.com/questions/149932/naming-conventions-for-threads</a>\r
-</p>\r
-<p>\r
-\83V\83X\83e\83\80\82ª\96¼\91O\82ð\8b\90§\82·\82é\8fê\8d\87, SDL\82Í\82»\82Ì\96¼\91O\82É\95Ï\8a·\82·\82é. \82µ\82©\82µ, \8c³\82Ì\95¶\8e\9a\97ñ\82Í<a href="SDL_GetThreadName.html">SDL_GetThreadName()</a>\82Å\93¾\82ç\82ê\82é.\r
+<code>\r
+SDL_CreateThreadWithStackSize(fn, name, 0, data);\r
+</code>\r
</p>\r
+<h2>\83o\81[\83W\83\87\83\93</h2>\r
+SDL 2.0.0\88È\8d~\r
<h2>\8aÖ\98A\8d\80\96Ú(\8aÖ\90\94)</h2>\r
+<a href="SDL_CreateThreadWithStackSize.html">SDL_CreateThreadWithStackSize</a><br>\r
<a href="SDL_WaitThread.html">SDL_WaitThread</a><br>\r
<h2>SDL Wiki\82Ö\82Ì\83\8a\83\93\83N</h2>\r
<a href="https://wiki.libsdl.org/SDL_CreateThread">SDL_CreateThread - SDL Wiki</a>\r