Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit d9aa04f9 authored by schultezub's avatar schultezub
Browse files

fixed thread-safety in OpenGLJobProcessor

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@286 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent 27e6e524
......@@ -117,10 +117,10 @@ namespace TUMVis {
}
// third: execute paint job
if ((jobToDo = a->second->_paintJob) != 0) {
jobToDo = a->second->_paintJob.fetch_and_store(0);
if (jobToDo != 0) {
jobToDo->execute();
delete jobToDo;
a->second->_paintJob = 0;
}
}
......@@ -140,10 +140,12 @@ namespace TUMVis {
if (_contextQueueMap.find(a, canvas)) {
switch (priority) {
case PaintJob:
if (a->second->_paintJob != 0)
delete a->second->_paintJob;
a->second->_paintJob = job;
break;
{
AbstractJob* oldJob = a->second->_paintJob.fetch_and_store(job);
if (oldJob != 0)
delete oldJob;
break;
}
case SerialJob:
a->second->_serialJobs.push(job);
break;
......
......@@ -119,9 +119,9 @@ namespace TUMVis {
/**
* Creates an empty PerContextJobQueue.
*/
PerContextJobQueue()
: _paintJob(0)
{}
PerContextJobQueue() {
_paintJob = 0;
}
/**
* Destructor, deletes all enqueued jobs.
......@@ -137,7 +137,7 @@ namespace TUMVis {
delete jobToDelete;
}
AbstractJob* _paintJob; ///< PaintJob of the context
tbb::atomic<AbstractJob*> _paintJob; ///< PaintJob of the context
tbb::concurrent_queue<AbstractJob*> _serialJobs; ///< Queue of serial jobs for the context
tbb::concurrent_queue<AbstractJob*> _lowPriorityJobs; ///< Queue of jow priority jobs for the context
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment