OSDN Git Service

SDL_HINT_RENDER_DRIVER metalを追加した https://wiki.libsdl.org/SDL_HINT_RENDER_DRIVER...
[sdl2referencejp/sdl2referencejp.git] / SDL_CondWait.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r
2 <html lang="ja-JP">\r
3 <head>\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="CategoryMutex.html" title="1\82Â\8fã">\r
9 <title>SDL_CondWait</title>\r
10 </head>\r
11 <body>\r
12 <a href="index.html">\96Ú\8e\9f</a> - <a href="ApiByCategory.html">API(\8b@\94\\95Ê)</a> - <a href="CategoryMutex.html">\93¯\8aú\83v\83\8a\83~\83e\83B\83u</a> - SDL_CondWait\r
13 <hr>\r
14 <h1>SDL_CondWait</h1>\r
15 \8fð\8c\8f\95Ï\90\94\82ª\92Ê\92m\82³\82ê\82é\82Ü\82Å\91Ò\82Â\r
16 <h2>\8d\\95¶</h2>\r
17 <code>int SDL_CondWait(SDL_cond* cond, SDL_mutex* mutex)</code>\r
18 <h2>\88ø\90\94</h2>\r
19 <table border="1" summary="SDL_CondWait">\r
20 <tr><td>cond</td><td>\91Ò\82Â\8fð\8c\8f\95Ï\90\94</td></tr>\r
21 <tr><td>mutex</td><td>\83X\83\8c\83b\83h\83A\83N\83Z\83X\82ð\90§\8cä\82·\82é\82½\82ß\82Ìmutex</td></tr>\r
22 </table>\r
23 <h2>\96ß\82è\92l</h2>\r
24 \90¬\8c÷\82Ì\82Æ\82«0, \8e¸\94s\82Ì\82Æ\82«\95\89\82Ì\90\94\82Ì\83G\83\89\81[\83R\81[\83h\82ð\96ß\82·.\r
25 <a href="SDL_GetError.html">SDL_GetError()</a>\82Å\8fÚ\8d×\82ð\92m\82é\82±\82Æ\82ª\82Å\82«\82é.\r
26 <h2>\83T\83\93\83v\83\8b\83R\81[\83h</h2>\r
27 <p>\r
28 \8fð\8c\8f\95Ï\90\94\82Ì\93T\8c^\93I\82È\8eg\82¢\95û:\r
29 <code>\r
30 <pre>\r
31 SDL_bool condition = SDL_FALSE;\r
32 SDL_mutex *lock;\r
33 SDL_cond *cond;\r
34 \r
35 lock = SDL_CreateMutex();\r
36 cond = SDL_CreateCond();\r
37 .\r
38 .\r
39 Thread A:\r
40     SDL_LockMutex(lock);\r
41     while (!condition) {\r
42         SDL_CondWait(cond, lock);\r
43     }\r
44     SDL_UnlockMutex(lock);\r
45 \r
46 Thread B:\r
47     SDL_LockMutex(lock);\r
48     ...\r
49     condition = SDL_TRUE;\r
50     ...\r
51     SDL_CondSignal(cond);\r
52     SDL_UnlockMutex(lock);\r
53 .\r
54 .\r
55 SDL_DestroyCond(cond);\r
56 SDL_DestroyMutex(lock);\r
57 </pre>\r
58 </code>\r
59 </p>\r
60 <h2>\8fÚ\8d×</h2>\r
61 <p>\r
62 \82±\82Ì\8aÖ\90\94\82Ímutex\82Ì\83\8d\83b\83N\82ð\89ð\8f\9c\82µ, \95Ê\82Ì\83X\83\8c\83b\83h\82ª<a href="SDL_CondSignal.html">SDL_CondSignal()</a>\82©<a href="SDL_CondBroadcast.html">SDL_CondBroadcast()</a>\82ð\8cÄ\82ñ\82Å\8fð\8c\8f\95Ï\90\94cond\82ð\92Ê\92m\82·\82é\82Ü\82Å\91Ò\82Â.\r
63 \8fð\8c\8f\95Ï\90\94\82ª\92Ê\92m\82³\82ê\82ê\82Î, mutex\82Í\8dÄ\82Ñ\83\8d\83b\83N\82³\82ê, \8aÖ\90\94\82©\82ç\96ß\82é.\r
64 </p>\r
65 <p>\r
66 mutex\82Í\82±\82Ì\8aÖ\90\94\82ð\8cÄ\82Ô\91O\82É\83\8d\83b\83N\82³\82ê\82Ä\82¢\82é\95K\97v\82ª\82 \82é.\r
67 </p>\r
68 <p>\r
69 \82±\82Ì\8aÖ\90\94\82Í, <a href="SDL_CondWaitTimeout.html">SDL_CondWaitTimeout()</a>\82Ì\91Ò\82¿\8e\9e\8aÔ\82ðSDL_MUTEX_MAXWAIT\82Æ\82µ\82½\82Ì\82Æ\93¯\82\82Å\82 \82é.\r
70 </p>\r
71 <h2>\8aÖ\98A\8d\80\96Ú(\8aÖ\90\94)</h2>\r
72 <a href="SDL_CondBroadcast.html">SDL_CondBroadcast</a><br>\r
73 <a href="SDL_CondSignal.html">SDL_CondSignal</a><br>\r
74 <a href="SDL_CondWaitTimeout.html">SDL_CondWaitTimeout</a><br>\r
75 <a href="SDL_CreateCond.html">SDL_CreateCond</a><br>\r
76 <a href="SDL_DestroyCond.html">SDL_DestroyCond</a><br>\r
77 <h2>SDL Wiki\82Ö\82Ì\83\8a\83\93\83N</h2>\r
78 <a href="https://wiki.libsdl.org/SDL_CondWait">SDL_CondWait - SDL Wiki</a>\r
79 <hr>\r
80 </body>\r
81 </html>\r