Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include <errno.h> | 5 #include <errno.h> |
| 6 #include <pthread.h> | 6 #include <pthread.h> |
| 7 | 7 |
| 8 #include "vm/assert.h" | 8 #include "vm/assert.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 | 24 |
| 25 void Isolate::SetCurrent(Isolate* current) { | 25 void Isolate::SetCurrent(Isolate* current) { |
| 26 ASSERT(isolate_key != PTHREAD_KEY_UNSET); | 26 ASSERT(isolate_key != PTHREAD_KEY_UNSET); |
| 27 int result = pthread_setspecific(isolate_key, current); | 27 int result = pthread_setspecific(isolate_key, current); |
| 28 VALIDATE_PTHREAD_RESULT(result); | 28 VALIDATE_PTHREAD_RESULT(result); |
| 29 } | 29 } |
| 30 | 30 |
| 31 | 31 |
| 32 // Empty isolate init callback which is registered before VM isolate creation. | 32 // Empty isolate init callback which is registered before VM isolate creation. |
| 33 static void* VMIsolateInitCallback(void* data) { | 33 static bool VMIsolateInitCallback(Dart_IsolateError error) { |
|
turnidge
2011/11/23 18:05:12
Maybe rename to "VMIsolateCreateCallback".
siva
2011/11/23 22:37:27
Done.
| |
| 34 return reinterpret_cast<void*>(1); | 34 return true; |
| 35 } | 35 } |
| 36 | 36 |
| 37 | 37 |
| 38 void Isolate::InitOnce() { | 38 void Isolate::InitOnce() { |
| 39 ASSERT(isolate_key == PTHREAD_KEY_UNSET); | 39 ASSERT(isolate_key == PTHREAD_KEY_UNSET); |
| 40 int result = pthread_key_create(&isolate_key, NULL); | 40 int result = pthread_key_create(&isolate_key, NULL); |
| 41 // Make sure creating a key was successful. | 41 // Make sure creating a key was successful. |
| 42 VALIDATE_PTHREAD_RESULT(result); | 42 VALIDATE_PTHREAD_RESULT(result); |
| 43 ASSERT(isolate_key != PTHREAD_KEY_UNSET); | 43 ASSERT(isolate_key != PTHREAD_KEY_UNSET); |
| 44 init_callback_ = VMIsolateInitCallback; | 44 create_init_callback_ = VMIsolateInitCallback; |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace dart | 47 } // namespace dart |
| OLD | NEW |