OSDN Git Service

SDL_atomic_t サンプルコードを修正 https://wiki.libsdl.org/SDL_atomic_t?action=diff&rev1=3&rev2=4
[sdl2referencejp/sdl2referencejp.git] / SDL_CreateCond.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_CreateCond</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_CreateCond\r
13 <hr>\r
14 <h1>SDL_CreateCond</h1>\r
15 \90V\82µ\82¢\8fð\8c\8f\95Ï\90\94\82ð\90\90¬\82·\82é\r
16 <h2>\8d\\95¶</h2>\r
17 <code>SDL_cond* SDL_CreateCond(void)</code>\r
18 <h2>\96ß\82è\92l</h2>\r
19 \90V\82µ\82¢\8fð\8c\8f\95Ï\90\94\82ð\96ß\82·. \8e¸\94s\82Ì\82Æ\82«NULL\82ð\96ß\82·.\r
20 <a href="SDL_GetError.html">SDL_GetError()</a>\82Å\8fÚ\8d×\82ð\92m\82é\82±\82Æ\82ª\82Å\82«\82é.\r
21 <h2>\83T\83\93\83v\83\8b\83R\81[\83h</h2>\r
22 <p>\r
23 \8fð\8c\8f\95Ï\90\94\82Ì\93T\8c^\93I\82È\8eg\82¢\95û:\r
24 <code>\r
25 <pre>\r
26 SDL_bool condition = SDL_FALSE;\r
27 SDL_mutex *lock;\r
28 SDL_cond *cond;\r
29 \r
30 lock = SDL_CreateMutex();\r
31 cond = SDL_CreateCond();\r
32 .\r
33 .\r
34 Thread A:\r
35     SDL_LockMutex(lock);\r
36     while (!condition) {\r
37         SDL_CondWait(cond, lock);\r
38     }\r
39     SDL_UnlockMutex(lock);\r
40 \r
41 Thread B:\r
42     SDL_LockMutex(lock);\r
43     ...\r
44     condition = SDL_TRUE;\r
45     ...\r
46     SDL_CondSignal(cond);\r
47     SDL_UnlockMutex(lock);\r
48 .\r
49 .\r
50 SDL_DestroyCond(cond);\r
51 SDL_DestroyMutex(lock);\r
52 </pre>\r
53 </code>\r
54 </p>\r
55 <h2>\8aÖ\98A\8d\80\96Ú(\8aÖ\90\94)</h2>\r
56 <a href="SDL_CondBroadcast.html">SDL_CondBroadcast</a><br>\r
57 <a href="SDL_CondSignal.html">SDL_CondSignal</a><br>\r
58 <a href="SDL_CondWait.html">SDL_CondWait</a><br>\r
59 <a href="SDL_CondWaitTimeout.html">SDL_CondWaitTimeout</a><br>\r
60 <a href="SDL_DestroyCond.html">SDL_DestroyCond</a><br>\r
61 <h2>SDL Wiki\82Ö\82Ì\83\8a\83\93\83N</h2>\r
62 <a href="https://wiki.libsdl.org/SDL_CreateCond">SDL_CreateCond - SDL Wiki</a>\r
63 <hr>\r
64 </body>\r
65 </html>\r