Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 1011 vs 1012 for /trunk/Source Code/Core/TaskPool.cpp

Diff revisions: vs.
  @@ -60,7 +60,7 @@
60 60 }
61 61
62 62 TaskPool::TaskState TaskPool::state(U32 index) const {
63 - UniqueLock lk(_taskStateLock);
63 + ReadLock lk(_taskStateLock);
64 64 return _taskStates[index];
65 65 }
66 66
  @@ -83,7 +83,7 @@
83 83 });
84 84 }
85 85 // Possible race condition. Try to set all child states to false as well!
86 - UniqueLock lk(_taskStateLock);
86 + ReadLock lk(_taskStateLock);
87 87 finished = std::find_if(std::cbegin(_taskStates),
88 88 std::cend(_taskStates),
89 89 [](TaskState entry) {
  @@ -110,7 +110,7 @@
110 110 }
111 111
112 112 void TaskPool::taskStarted(U32 poolIndex, Task::TaskPriority priority) {
113 - UniqueLock lk(_taskStateLock);
113 + WriteLock lk(_taskStateLock);
114 114 _taskStates[poolIndex] = TaskState::TASK_RUNNING;
115 115 }
116 116
  @@ -121,7 +121,7 @@
121 121 runCbkAndClearTask(poolIndex);
122 122 }
123 123
124 - UniqueLock lk(_taskStateLock);
124 + WriteLock lk(_taskStateLock);
125 125 _taskStates[poolIndex] = TaskState::TASK_FREE;
126 126 }
127 127
  @@ -149,7 +149,7 @@
149 149 size_t failCount = 0;
150 150
151 151 {
152 - UniqueLock lk(_taskStateLock);
152 + WriteLock lk(_taskStateLock);
153 153 while(_taskStates[taskIndex] != TaskState::TASK_FREE) {
154 154 failCount++;
155 155 taskIndex = (++_allocatedJobs - 1u) & (poolSize - 1u);
  @@ -246,8 +246,7 @@
246 246 }
247 247 }
248 248
249 - updateTask.startTask(priority, taskFlags);
250 - updateTask.wait();
249 + updateTask.startTask(priority, taskFlags).wait();
251 250
252 251 return updateTask;
253 252 }