1 /* 2 delaboratory - color correction utility 3 Copyright (C) 2011 Jacek Poplawski 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef _DE_LAYER_PROCESSOR_THREADS_H 20 #define _DE_LAYER_PROCESSOR_THREADS_H 21 22 class deMainWindow; 23 class deLayerStack; 24 class deViewManager; 25 class deChannelManager; 26 class wxProgressDialog; 27 class deLayer; 28 class deLogger; 29 class deLayerFrameManager; 30 class wxThread; 31 #include <map> 32 #include "size.h" 33 #include "renderer.h" 34 #include "desemaphore.h" 35 #include "base_layer.h" 36 37 38 class deLayerProcessorThreads 39 { 40 private: 41 deLayerProcessor& layerProcessor; 42 wxThread* workerThread; 43 wxThread* renderWorkerThread; 44 wxThread* histogramWorkerThread; 45 deSemaphore workerSemaphore; 46 deSemaphore renderWorkerSemaphore; 47 deSemaphore histogramWorkerSemaphore; 48 public: deLayerProcessorThreads(deLayerProcessor & _layerProcessor)49 deLayerProcessorThreads(deLayerProcessor& _layerProcessor) 50 :layerProcessor(_layerProcessor), 51 workerSemaphore(1,1), 52 renderWorkerSemaphore(1, 1), 53 histogramWorkerSemaphore(1, 1) 54 { 55 histogramWorkerThread = NULL; 56 workerThread = NULL; 57 renderWorkerThread = NULL; 58 59 }; ~deLayerProcessorThreads()60 virtual ~deLayerProcessorThreads() 61 { 62 }; 63 void startWorkerThread(); 64 void stopWorkerThread(); renderPost()65 void renderPost() 66 { 67 renderWorkerSemaphore.post(); 68 } histogramPost()69 void histogramPost() 70 { 71 histogramWorkerSemaphore.post(); 72 } workerPost()73 void workerPost() 74 { 75 workerSemaphore.post(); 76 } 77 78 }; 79 80 81 #endif 82