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

Side by Side Diff: test/cctest/test-threads.cc

Issue 23748003: Cleanup Semaphore class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Build fix for Mac OS X. Created 7 years, 3 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 | « test/cctest/test-thread-termination.cc ('k') | test/cctest/test-time.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 int thread_no_; 173 int thread_no_;
174 i::Thread* thread_to_start_; 174 i::Thread* thread_to_start_;
175 i::Semaphore* semaphore_; 175 i::Semaphore* semaphore_;
176 }; 176 };
177 177
178 178
179 TEST(ThreadIdValidation) { 179 TEST(ThreadIdValidation) {
180 const int kNThreads = 100; 180 const int kNThreads = 100;
181 i::List<ThreadIdValidationThread*> threads(kNThreads); 181 i::List<ThreadIdValidationThread*> threads(kNThreads);
182 i::List<i::ThreadId> refs(kNThreads); 182 i::List<i::ThreadId> refs(kNThreads);
183 i::Semaphore* semaphore = i::OS::CreateSemaphore(0); 183 i::Semaphore* semaphore = new i::Semaphore(0);
184 ThreadIdValidationThread* prev = NULL; 184 ThreadIdValidationThread* prev = NULL;
185 for (int i = kNThreads - 1; i >= 0; i--) { 185 for (int i = kNThreads - 1; i >= 0; i--) {
186 ThreadIdValidationThread* newThread = 186 ThreadIdValidationThread* newThread =
187 new ThreadIdValidationThread(prev, &refs, i, semaphore); 187 new ThreadIdValidationThread(prev, &refs, i, semaphore);
188 threads.Add(newThread); 188 threads.Add(newThread);
189 prev = newThread; 189 prev = newThread;
190 refs.Add(i::ThreadId::Invalid()); 190 refs.Add(i::ThreadId::Invalid());
191 } 191 }
192 prev->Start(); 192 prev->Start();
193 for (int i = 0; i < kNThreads; i++) { 193 for (int i = 0; i < kNThreads; i++) {
(...skipping 12 matching lines...) Expand all
206 Join(); 206 Join();
207 } 207 }
208 }; 208 };
209 209
210 210
211 TEST(ThreadJoinSelf) { 211 TEST(ThreadJoinSelf) {
212 ThreadC thread; 212 ThreadC thread;
213 thread.Start(); 213 thread.Start();
214 thread.Join(); 214 thread.Join();
215 } 215 }
OLDNEW
« no previous file with comments | « test/cctest/test-thread-termination.cc ('k') | test/cctest/test-time.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698