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

Side by Side Diff: native_client_sdk/src/libraries/sdk_util/thread_safe_queue.h

Issue 16325024: Move thread_pool.h into utils so it can be shared by more than one example. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef LIBRARIES_UTILS_THREAD_SAFE_QUEUE_H_ 5 #ifndef LIBRARIES_SDK_UTIL_THREAD_SAFE_QUEUE_H_
6 #define LIBRARIES_UTILS_THREAD_SAFE_QUEUE_H_ 6 #define LIBRARIES_SDK_UTIL_THREAD_SAFE_QUEUE_H_
7 7
8 #include <pthread.h> 8 #include <pthread.h>
9 9
10 #include <list> 10 #include <list>
11 11
12 #include "utils/auto_lock.h" 12 #include "sdk_util/auto_lock.h"
13 #include "utils/macros.h" 13 #include "sdk_util/macros.h"
14 14
15 15
16 // ThreadSafeQueue 16 // ThreadSafeQueue
17 // 17 //
18 // A simple template to support multithreaded and optionally blocking access 18 // A simple template to support multithreaded and optionally blocking access
19 // to a Queue of object pointers. 19 // to a Queue of object pointers.
20 // 20 //
21 template<class T> class ThreadSafeQueue { 21 template<class T> class ThreadSafeQueue {
22 public: 22 public:
23 ThreadSafeQueue() { 23 ThreadSafeQueue() {
(...skipping 28 matching lines...) Expand all
52 return item; 52 return item;
53 } 53 }
54 54
55 private: 55 private:
56 std::list<T*> list_; 56 std::list<T*> list_;
57 pthread_cond_t cond_; 57 pthread_cond_t cond_;
58 pthread_mutex_t mutex_; 58 pthread_mutex_t mutex_;
59 DISALLOW_COPY_AND_ASSIGN(ThreadSafeQueue); 59 DISALLOW_COPY_AND_ASSIGN(ThreadSafeQueue);
60 }; 60 };
61 61
62 #endif // LIBRARIES_UTILS_THREAD_SAFE_QUEUE_H_ 62 #endif // LIBRARIES_SDK_UTIL_THREAD_SAFE_QUEUE_H_
63
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698