Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Side by Side Diff: native_client_sdk/src/examples/hello_nacl_io/queue.h

Issue 13106002: [NaCl SDK] A bunch of spelling fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix presubmit Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef QUEUE_H_ 6 #ifndef QUEUE_H_
7 #define QUEUE_H_ 7 #define QUEUE_H_
8 8
9 /* This file implements a single-producer/single-consumer queue, using a mutex 9 /* This file implements a single-producer/single-consumer queue, using a mutex
10 * and a condition variable. 10 * and a condition variable.
11 * 11 *
12 * There are techniques to implement a queue like this without using memory 12 * There are techniques to implement a queue like this without using memory
13 * barriers or locks on x86, but ARM's memory system is different from x86, so 13 * barriers or locks on x86, but ARM's memory system is different from x86, so
14 * we cannot make the same assuptions about visibility order of writes. Using a 14 * we cannot make the same assumptions about visibility order of writes. Using a
15 * mutex is slower, but also simpler. 15 * mutex is slower, but also simpler.
16 * 16 *
17 * We make the assumption that messages are only enqueued on the main thread 17 * We make the assumption that messages are only enqueued on the main thread
18 * and consumed on the worker thread. Because we don't want to block the main 18 * and consumed on the worker thread. Because we don't want to block the main
19 * thread, EnqueueMessage will return zero if the message could not be enqueued. 19 * thread, EnqueueMessage will return zero if the message could not be enqueued.
20 * 20 *
21 * DequeueMessage will block until a message is available using a condition 21 * DequeueMessage will block until a message is available using a condition
22 * variable. Again, this may not be as fast as spin-waiting, but will consume 22 * variable. Again, this may not be as fast as spin-waiting, but will consume
23 * much less CPU (and battery), which is important to consider for ChromeOS 23 * much less CPU (and battery), which is important to consider for ChromeOS
24 * devices. */ 24 * devices. */
25 25
26 void InitializeMessageQueue(); 26 void InitializeMessageQueue();
27 int EnqueueMessage(char* message); 27 int EnqueueMessage(char* message);
28 char* DequeueMessage(); 28 char* DequeueMessage();
29 29
30 #endif /* QUEUE_H_ */ 30 #endif /* QUEUE_H_ */
OLDNEW
« no previous file with comments | « native_client_sdk/src/examples/geturl/geturl_handler.h ('k') | native_client_sdk/src/examples/hello_world_gles/hello_world.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698