OLD | NEW |
1 // Copyright 2007-2011 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2011 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 virtual ~JoinableThread() {} | 136 virtual ~JoinableThread() {} |
137 | 137 |
138 void Start() { | 138 void Start() { |
139 thread_.Start(); | 139 thread_.Start(); |
140 } | 140 } |
141 | 141 |
142 void Join() { | 142 void Join() { |
143 semaphore_.Wait(); | 143 semaphore_.Wait(); |
| 144 thread_.Join(); |
144 } | 145 } |
145 | 146 |
146 virtual void Run() = 0; | 147 virtual void Run() = 0; |
147 | 148 |
148 private: | 149 private: |
149 class ThreadWithSemaphore : public v8::base::Thread { | 150 class ThreadWithSemaphore : public v8::base::Thread { |
150 public: | 151 public: |
151 explicit ThreadWithSemaphore(JoinableThread* joinable_thread) | 152 explicit ThreadWithSemaphore(JoinableThread* joinable_thread) |
152 : Thread(Options(joinable_thread->name_)), | 153 : Thread(Options(joinable_thread->name_)), |
153 joinable_thread_(joinable_thread) {} | 154 joinable_thread_(joinable_thread) {} |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 kSimpleExtensionSource)); | 736 kSimpleExtensionSource)); |
736 const char* extension_names[] = { "test0", "test1", | 737 const char* extension_names[] = { "test0", "test1", |
737 "test2", "test3", "test4", | 738 "test2", "test3", "test4", |
738 "test5", "test6", "test7" }; | 739 "test5", "test6", "test7" }; |
739 i::List<JoinableThread*> threads(kNThreads); | 740 i::List<JoinableThread*> threads(kNThreads); |
740 for (int i = 0; i < kNThreads; i++) { | 741 for (int i = 0; i < kNThreads; i++) { |
741 threads.Add(new IsolateGenesisThread(8, extension_names)); | 742 threads.Add(new IsolateGenesisThread(8, extension_names)); |
742 } | 743 } |
743 StartJoinAndDeleteThreads(threads); | 744 StartJoinAndDeleteThreads(threads); |
744 } | 745 } |
OLD | NEW |