| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 semaphore_->Signal(); | 168 semaphore_->Signal(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 private: | 171 private: |
| 172 i::List<i::ThreadId>* refs_; | 172 i::List<i::ThreadId>* refs_; |
| 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 TEST(ThreadIdValidation) { | 179 TEST(ThreadIdValidation) { |
| 179 const int kNThreads = 100; | 180 const int kNThreads = 100; |
| 180 i::List<ThreadIdValidationThread*> threads(kNThreads); | 181 i::List<ThreadIdValidationThread*> threads(kNThreads); |
| 181 i::List<i::ThreadId> refs(kNThreads); | 182 i::List<i::ThreadId> refs(kNThreads); |
| 182 i::Semaphore* semaphore = i::OS::CreateSemaphore(0); | 183 i::Semaphore* semaphore = i::OS::CreateSemaphore(0); |
| 183 ThreadIdValidationThread* prev = NULL; | 184 ThreadIdValidationThread* prev = NULL; |
| 184 for (int i = kNThreads - 1; i >= 0; i--) { | 185 for (int i = kNThreads - 1; i >= 0; i--) { |
| 185 ThreadIdValidationThread* newThread = | 186 ThreadIdValidationThread* newThread = |
| 186 new ThreadIdValidationThread(prev, &refs, i, semaphore); | 187 new ThreadIdValidationThread(prev, &refs, i, semaphore); |
| 187 threads.Add(newThread); | 188 threads.Add(newThread); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 205 Join(); | 206 Join(); |
| 206 } | 207 } |
| 207 }; | 208 }; |
| 208 | 209 |
| 209 | 210 |
| 210 TEST(ThreadJoinSelf) { | 211 TEST(ThreadJoinSelf) { |
| 211 ThreadC thread; | 212 ThreadC thread; |
| 212 thread.Start(); | 213 thread.Start(); |
| 213 thread.Join(); | 214 thread.Join(); |
| 214 } | 215 } |
| OLD | NEW |