| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 Thread::YieldCPU(); | 120 Thread::YieldCPU(); |
| 121 } while (true); | 121 } while (true); |
| 122 } | 122 } |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 | 125 |
| 126 TEST(JSFunctionResultCachesInTwoThreads) { | 126 TEST(JSFunctionResultCachesInTwoThreads) { |
| 127 v8::V8::Initialize(); | 127 v8::V8::Initialize(); |
| 128 | 128 |
| 129 ThreadA threadA; | 129 { |
| 130 ThreadB threadB; | 130 v8::Unlocker unlock; |
| 131 | 131 |
| 132 threadA.Start(); | 132 ThreadA threadA; |
| 133 threadB.Start(); | 133 ThreadB threadB; |
| 134 | 134 |
| 135 threadA.Join(); | 135 threadA.Start(); |
| 136 threadB.Join(); | 136 threadB.Start(); |
| 137 |
| 138 threadA.Join(); |
| 139 threadB.Join(); |
| 140 } |
| 137 | 141 |
| 138 CHECK_EQ(DONE, turn); | 142 CHECK_EQ(DONE, turn); |
| 139 } | 143 } |
| 140 | 144 |
| 141 class ThreadIdValidationThread : public v8::internal::Thread { | 145 class ThreadIdValidationThread : public v8::internal::Thread { |
| 142 public: | 146 public: |
| 143 ThreadIdValidationThread(i::Thread* thread_to_start, | 147 ThreadIdValidationThread(i::Thread* thread_to_start, |
| 144 i::List<i::ThreadId>* refs, | 148 i::List<i::ThreadId>* refs, |
| 145 unsigned int thread_no, | 149 unsigned int thread_no, |
| 146 i::Semaphore* semaphore) | 150 i::Semaphore* semaphore) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 Join(); | 203 Join(); |
| 200 } | 204 } |
| 201 }; | 205 }; |
| 202 | 206 |
| 203 | 207 |
| 204 TEST(ThreadJoinSelf) { | 208 TEST(ThreadJoinSelf) { |
| 205 ThreadC thread; | 209 ThreadC thread; |
| 206 thread.Start(); | 210 thread.Start(); |
| 207 thread.Join(); | 211 thread.Join(); |
| 208 } | 212 } |
| OLD | NEW |