Index: runtime/vm/thread_pool.cc |
=================================================================== |
--- runtime/vm/thread_pool.cc (revision 45815) |
+++ runtime/vm/thread_pool.cc (working copy) |
@@ -274,11 +274,8 @@ |
// Release monitor while handling the task. |
monitor_.Exit(); |
- Thread::EnsureInit(); |
task->Run(); |
ASSERT(Isolate::Current() == NULL); |
- // Prevent unintended sharing of state between tasks. |
- Thread::CleanUp(); |
delete task; |
monitor_.Enter(); |
@@ -318,6 +315,7 @@ |
// static |
void ThreadPool::Worker::Main(uword args) { |
+ Thread::EnsureInit(); |
Worker* worker = reinterpret_cast<Worker*>(args); |
worker->Loop(); |
@@ -333,6 +331,9 @@ |
ml.Notify(); |
} |
delete worker; |
+#if defined(TARGET_OS_WINDOWS) |
+ Thread::CleanUp(); |
+#endif |
} |
} // namespace dart |