All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Brief description of class still missing. More...
#include <LayerPainterThread.h>
Public Member Functions | |
LayerPainterRequest * | currentRequest () const |
LayerPainterThread (LayerPainter *parent) | |
void | terminate () |
Protected Member Functions | |
virtual void | run () |
Brief description of class still missing.
Full description of class still missing
: Thread(parent), _parent(parent) { _terminate=false; _currentRequest=0; }
LayerPainterRequest* SciFigs::LayerPainterThread::currentRequest | ( | ) | const [inline] |
{return _currentRequest;}
void SciFigs::LayerPainterThread::run | ( | ) | [protected, virtual] |
References SciFigs::LayerPainterRequest::paint(), QGpCoreTools::Thread::setSleeping(), and TRACE.
{ // CRASH: segmentation fault reported under windows Vista while closing Figue TRACE; while(true) { while(true) { if(_terminate.testAndSetOrdered(true, true)) { return; } // Check for new layers to paint, if nothing to do, the thread goes in sleep mode _parent->_queueMutex.lock(); if(_parent->_queue.isEmpty()) { _parent->_queueMutex.unlock(); break; } _currentRequest=_parent->_queue.dequeue(); _parent->_queueMutex.unlock(); //printf("%s: start painting %p\n",objectName().toAscii().data(), _currentRequest->graphContent()); _currentRequest->paint(); //printf("%s: stop painting %p\n",objectName().toAscii().data(), _currentRequest->graphContent()); LayerPainterRequest * r=_currentRequest; _parent->_queueMutex.lock(); _currentRequest=0; _parent->_queueMutex.unlock(); r->deleteLater(); } _parent->_waitMutex.lock(); //printf("%s: sleeping\n",objectName().toAscii().data()); setSleeping(true); _parent->_paintEvent.wait(&_parent->_waitMutex); setSleeping(false); //printf("%s: waking up\n",objectName().toAscii().data()); _parent->_waitMutex.unlock(); } }
References SciFigs::LayerPainterRequest::terminate().
{ _terminate.fetchAndStoreOrdered(true); _parent->_queueMutex.lock(); if(_currentRequest) _currentRequest->terminate(); _parent->_queueMutex.unlock(); }