| OLD | NEW | 
|---|
| 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  Loading... | 
| 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  Loading... | 
| 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 } | 
| OLD | NEW | 
|---|