Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(952)

Side by Side Diff: runtime/vm/gc_sweeper.cc

Issue 2349853002: VM: Fix for deadlock with background tasks. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/dart_api_state.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "vm/gc_sweeper.h" 5 #include "vm/gc_sweeper.h"
6 6
7 #include "vm/freelist.h" 7 #include "vm/freelist.h"
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/lockers.h" 10 #include "vm/lockers.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 first_(first), 104 first_(first),
105 last_(last), 105 last_(last),
106 freelist_(freelist) { 106 freelist_(freelist) {
107 ASSERT(task_isolate_ != NULL); 107 ASSERT(task_isolate_ != NULL);
108 ASSERT(first_ != NULL); 108 ASSERT(first_ != NULL);
109 ASSERT(old_space_ != NULL); 109 ASSERT(old_space_ != NULL);
110 ASSERT(last_ != NULL); 110 ASSERT(last_ != NULL);
111 ASSERT(freelist_ != NULL); 111 ASSERT(freelist_ != NULL);
112 MonitorLocker ml(old_space_->tasks_lock()); 112 MonitorLocker ml(old_space_->tasks_lock());
113 old_space_->set_tasks(old_space_->tasks() + 1); 113 old_space_->set_tasks(old_space_->tasks() + 1);
114 ml.Notify();
115 } 114 }
116 115
117 virtual void Run() { 116 virtual void Run() {
118 bool result = Thread::EnterIsolateAsHelper(task_isolate_, 117 bool result = Thread::EnterIsolateAsHelper(task_isolate_,
119 Thread::kSweeperTask); 118 Thread::kSweeperTask);
120 ASSERT(result); 119 ASSERT(result);
121 { 120 {
122 Thread* thread = Thread::Current(); 121 Thread* thread = Thread::Current();
123 TIMELINE_FUNCTION_GC_DURATION(thread, "SweeperTask"); 122 TIMELINE_FUNCTION_GC_DURATION(thread, "SweeperTask");
124 GCSweeper sweeper; 123 GCSweeper sweeper;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 SweeperTask* task = 171 SweeperTask* task =
173 new SweeperTask(isolate, 172 new SweeperTask(isolate,
174 isolate->heap()->old_space(), 173 isolate->heap()->old_space(),
175 first, last, 174 first, last,
176 freelist); 175 freelist);
177 ThreadPool* pool = Dart::thread_pool(); 176 ThreadPool* pool = Dart::thread_pool();
178 pool->Run(task); 177 pool->Run(task);
179 } 178 }
180 179
181 } // namespace dart 180 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698