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

Side by Side Diff: native_client_sdk/src/examples/demo/voronoi/threadpool.h

Issue 16266004: Change default to not use pthreads at startup (all calculations on main thread) (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
« no previous file with comments | « no previous file | native_client_sdk/src/examples/demo/voronoi/threadpool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Simple thread pool class 5 // Simple thread pool class
6 6
7 #ifndef EXAMPLES_DEMO_VORONOI_THREADPOOL_H_ 7 #ifndef EXAMPLES_DEMO_VORONOI_THREADPOOL_H_
8 #define EXAMPLES_DEMO_VORONOI_THREADPOOL_H_ 8 #define EXAMPLES_DEMO_VORONOI_THREADPOOL_H_
9 9
10 #include <pthread.h> 10 #include <pthread.h>
(...skipping 20 matching lines...) Expand all
31 void DispatchHere(int num_tasks, WorkFunction work, void* data); 31 void DispatchHere(int num_tasks, WorkFunction work, void* data);
32 void WorkLoop(); 32 void WorkLoop();
33 static void* WorkerThreadEntry(void* data); 33 static void* WorkerThreadEntry(void* data);
34 void PostExitAndJoinAll(); 34 void PostExitAndJoinAll();
35 pthread_t* threads_; 35 pthread_t* threads_;
36 int counter_; 36 int counter_;
37 const int num_threads_; 37 const int num_threads_;
38 bool exiting_; 38 bool exiting_;
39 void* user_data_; 39 void* user_data_;
40 WorkFunction user_work_function_; 40 WorkFunction user_work_function_;
41 pthread_mutex_t mutex_;
42 sem_t work_sem_; 41 sem_t work_sem_;
43 sem_t done_sem_; 42 sem_t done_sem_;
44 }; 43 };
45 #endif // EXAMPLES_DEMO_VORONOI_THREADPOOL_H_ 44 #endif // EXAMPLES_DEMO_VORONOI_THREADPOOL_H_
46 45
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/examples/demo/voronoi/threadpool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698