1 /* 2 Copyright (C) 2013-2021, Dirk Krause 3 SPDX-License-Identifier: BSD-3-Clause 4 */ 5 6 /* 7 WARNING: This file was generated by the dkct program (see 8 http://dktools.sourceforge.net/ for details). 9 Changes you make here will be lost if dkct is run again! 10 You should modify the original source and run dkct on it. 11 Original source: DkWxProcessingIdleController.cpt 12 */ 13 14 /** @file DkWxProcessingIdleController.h Header file for the DkWxProcessingIdleController module. 15 */ 16 17 #ifndef DKWXPROCESSINGIDLECONTROLLER_H_INCLUDED 18 /** Avoid multiple inclusions. */ 19 #define DKWXPROCESSINGIDLECONTROLLER_H_INCLUDED 1 20 21 22 #ifndef DK3CONF_H_INCLUDED 23 #include "dk3conf.h" 24 #endif 25 26 #ifndef DKWXPROCESSINGCONTROLLER_H_INCLUDED 27 #include <libdk3wx/DkWxProcessingController.h> 28 #endif 29 30 31 /** Protect idle event handler from concurrent execution. 32 In contrast to a critical section which delays execution of 33 code this class skips the code execution. 34 */ 35 class DkWxProcessingIdleController : public DkWxProcessingController 36 { 37 protected: 38 39 /** Avoid concurrent access to bWantMore. 40 */ 41 wxMutex mxProtectWantMore; 42 43 /** Flag: More idle events wanted. 44 */ 45 bool bWantMore; 46 47 public: 48 49 /** Constructor. 50 */ 51 DkWxProcessingIdleController(); 52 53 /** Indicate interest in more idle events (thread-safe). 54 @param value New flag value. 55 */ 56 void setWantMore(bool value = true); 57 58 /** Indicate no more interest in further idle events (thread-safe). 59 */ 60 void resetWantMore(void); 61 62 /** Check for interest in further idle events (thread-safe). 63 @return true to ask for further events, false otherwise. 64 */ 65 bool wantMore(void); 66 67 }; 68 69 70 71 #endif 72