1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
\r
4 <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
\r
5 <meta http-equiv="Content-Style-Type" content="text/css">
\r
6 <meta name="keywords" content="Simple Directmedia Layer SDL2.0">
\r
7 <link rel="top" href="index.html" title="
\83z
\81[
\83\80">
\r
8 <link rel="parent" href="CategoryThread.html" title="1
\82Â
\8fã">
\r
9 <title>SDL_CreateThread</title>
\r
12 <a href="index.html">
\96Ú
\8e\9f</a> - <a href="ApiByCategory.html">API(
\8b@
\94\
\95Ê)</a> - <a href="CategoryThread.html">
\83X
\83\8c\83b
\83h</a> - SDL_CreateThread
\r
14 <h1>SDL_CreateThread</h1>
\r
15 \90V
\82µ
\82¢
\83X
\83\8c\83b
\83h
\82ð
\90¶
\90¬
\82·
\82é
\r
17 <code>SDL_Thread* SDL_CreateThread(SDL_ThreadFunction fn, const char* name, void* data)</code>
\r
19 <table border="1" summary="SDL_CreateThread">
\r
20 <tr><td>fn</td><td>
\90V
\82µ
\82¢
\83X
\83\8c\83b
\83h
\82Å
\8cÄ
\82Ô
\8aÖ
\90\94 (
\8fÚ
\8d×
\82ð
\8eQ
\8fÆ
\82·
\82é
\82±
\82Æ)</td></tr>
\r
21 <tr><td>name</td><td>
\83X
\83\8c\83b
\83h
\82Ì
\96¼
\91O (
\8fÚ
\8d×
\82ð
\8eQ
\8fÆ
\82·
\82é
\82±
\82Æ)</td></tr>
\r
22 <tr><td>data</td><td>fn
\82Ö
\93n
\82·
\83|
\83C
\83\93\83^</td></tr>
\r
24 <h2>
\96ß
\82è
\92l</h2>
\r
25 \90¬
\8c÷
\82Ì
\82Æ
\82«
\90V
\82µ
\82¢
\83X
\83\8c\83b
\83h
\83I
\83u
\83W
\83F
\83N
\83g
\82Ö
\82Ì
\95s
\93§
\96¾
\83|
\83C
\83\93\83^(opaque pointer),
\8e¸
\94s
\82Ì
\82Æ
\82«NULL
\82ð
\96ß
\82·.
\r
26 <a href="SDL_GetError.html">SDL_GetError()</a>
\82Å
\8fÚ
\8d×
\82ð
\92m
\82é
\82±
\82Æ
\82ª
\82Å
\82«
\82é.
\r
27 <h2>
\83T
\83\93\83v
\83\8b\83R
\81[
\83h</h2>
\r
31 #include <stdio.h>
\r
32 #include "SDL_thread.h"
\r
34 /*
\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
35 static int TestThread(void *ptr)
\r
39 for (cnt = 0; cnt < 10; ++cnt) {
\r
40 printf("\n
\83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: %d", cnt);
\r
47 int main(int argc, char *argv[])
\r
50 int threadReturnValue;
\r
52 printf("\n
\92P
\8f\83\82ÈSDL_CreateThread
\82Ì
\83e
\83X
\83g:");
\r
54 /*
\92P
\82É
\83X
\83\8c\83b
\83h
\82ð
\90¶
\90¬
\82·
\82é */
\r
55 thread = SDL_CreateThread(TestThread, "TestThread", (void *)NULL);
\r
57 if (NULL == thread) {
\r
58 printf("\nSDL_CreateThread
\8e¸
\94s: %s\n", SDL_GetError());
\r
60 SDL_WaitThread(thread, &threadReturnValue);
\r
61 printf("\n
\83X
\83\8c\83b
\83h
\82Ì
\96ß
\82è
\92l: %d", threadReturnValue);
\r
73 SDL_CreateThread
\82Ì
\8aÈ
\92P
\82È
\83e
\83X
\83g:
\r
74 \83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: 0
\r
75 \83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: 1
\r
76 \83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: 2
\r
77 \83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: 3
\r
78 \83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: 4
\r
79 \83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: 5
\r
80 \83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: 6
\r
81 \83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: 7
\r
82 \83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: 8
\r
83 \83X
\83\8c\83b
\83h
\83J
\83E
\83\93\83^: 9
\r
84 \83X
\83\8c\83b
\83h
\82Ì
\96ß
\82è
\92l: 10
\r
90 <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
91 \8aÖ
\90\94fn
\82©
\82ç
\96ß
\82é
\82Æ
\83X
\83\8c\83b
\83h
\82Í
\8fI
\97¹
\82·
\82é.
\r
94 fn
\82Ì
\8aÖ
\90\94\83v
\83\8d\83g
\83^
\83C
\83v
\82Í
\r
97 <code>int SDL_ThreadFunction(void* data)</code>
\r
101 <table border="1" summary="fn">
\r
102 <tr><td>data</td><td><a href="SDL_CreateThread.html">SDL_CreateThread()</a>
\82É
\93n
\82µ
\82½data</td></tr>
\r
106 \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
109 <a href="http://stackoverflow.com/questions/149932/naming-conventions-for-threads">http://stackoverflow.com/questions/149932/naming-conventions-for-threads</a>
\r
112 \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
114 <h2>
\8aÖ
\98A
\8d\80\96Ú(
\8aÖ
\90\94)</h2>
\r
115 <a href="SDL_WaitThread.html">SDL_WaitThread</a><br>
\r
116 <h2>SDL Wiki
\82Ö
\82Ì
\83\8a\83\93\83N</h2>
\r
117 <a href="https://wiki.libsdl.org/SDL_CreateThread">SDL_CreateThread - SDL Wiki</a>
\r