OLD | NEW |
---|---|
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /** | 6 /** |
7 * Defines the PPB_MessageLoop interface. | 7 * Defines the PPB_MessageLoop interface. |
8 */ | 8 */ |
9 label Chrome { | 9 label Chrome { |
10 M25 = 1.0 | 10 M25 = 1.0 |
(...skipping 19 matching lines...) Expand all Loading... | |
30 * - Create the thread yourself (using pthreads). | 30 * - Create the thread yourself (using pthreads). |
31 * - Create the message loop resource. | 31 * - Create the message loop resource. |
32 * - Pass the message loop resource to your thread's main function. | 32 * - Pass the message loop resource to your thread's main function. |
33 * - Call PostWork() on the message loop to run functions on the thread. | 33 * - Call PostWork() on the message loop to run functions on the thread. |
34 * | 34 * |
35 * From the background thread's main function: | 35 * From the background thread's main function: |
36 * - Call AttachToCurrentThread() with the message loop resource. | 36 * - Call AttachToCurrentThread() with the message loop resource. |
37 * - Call Run() with the message loop resource. | 37 * - Call Run() with the message loop resource. |
38 * | 38 * |
39 * Your callacks should look like this: | 39 * Your callacks should look like this: |
40 * @code | |
dmichael (off chromium)
2013/03/28 21:56:50
Is there any reason to not just always use <code>
binji
2013/03/28 22:02:24
I haven't used doxygen much, but it seems like <co
| |
40 * void DoMyWork(void* user_data, int32_t status) { | 41 * void DoMyWork(void* user_data, int32_t status) { |
41 * if (status != PP_OK) { | 42 * if (status != PP_OK) { |
42 * Cleanup(); // e.g. free user_data. | 43 * Cleanup(); // e.g. free user_data. |
43 * return; | 44 * return; |
44 * } | 45 * } |
45 * ... do your work... | 46 * ... do your work... |
46 * } | 47 * } |
48 * @endcode | |
47 * For a C++ example, see ppapi/utility/threading/simple_thread.h | 49 * For a C++ example, see ppapi/utility/threading/simple_thread.h |
48 * | 50 * |
49 * (You can also create the message loop resource on the background thread, | 51 * (You can also create the message loop resource on the background thread, |
50 * but then the main thread will have no reference to it should you want to | 52 * but then the main thread will have no reference to it should you want to |
51 * call PostWork()). | 53 * call PostWork()). |
52 * | 54 * |
53 * | 55 * |
54 * THREAD HANDLING | 56 * THREAD HANDLING |
55 * | 57 * |
56 * The main thread has an implicitly created message loop. The main thread is | 58 * The main thread has an implicitly created message loop. The main thread is |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 * | 262 * |
261 * @return | 263 * @return |
262 * - PP_OK: The request to quit was successfully posted. | 264 * - PP_OK: The request to quit was successfully posted. |
263 * - PP_ERROR_BADRESOURCE: The message loop was invalid. | 265 * - PP_ERROR_BADRESOURCE: The message loop was invalid. |
264 * - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. | 266 * - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. |
265 * The main thread's message loop is managed by the system and can't be | 267 * The main thread's message loop is managed by the system and can't be |
266 * quit. | 268 * quit. |
267 */ | 269 */ |
268 int32_t PostQuit([in] PP_Resource message_loop, PP_Bool should_destroy); | 270 int32_t PostQuit([in] PP_Resource message_loop, PP_Bool should_destroy); |
269 }; | 271 }; |
OLD | NEW |