1 /*
2 Copyright (C) 2018-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: Dk4WxProcessingController.cpt
12 */
13 
14 /**	@file Dk4WxProcessingController.cpp The Dk4WxProcessingController module.
15 */
16 
17 
18 #ifndef	DK4CONF_H_INCLUDED
19 #if DK4_BUILDING_DKTOOLS4
20 #include "dk4conf.h"
21 #else
22 #include <dktools-4/dk4conf.h>
23 #endif
24 #endif
25 
26 #ifndef	DK4WXCRITICALSECTION_H_INCLUDED
27 #if DK4_BUILDING_DKTOOLS4
28 #include <libdk4wx/Dk4WxProcessingController.h>
29 #else
30 #include <dktools-4/Dk4WxProcessingController.h>
31 #endif
32 #endif
33 
34 
Dk4WxProcessingController(void)35 Dk4WxProcessingController::Dk4WxProcessingController(void)
36 {
37 	bInUse = false;
38 }
39 
40 
41 
42 bool
CanEnterCriticalSection(void)43 Dk4WxProcessingController::CanEnterCriticalSection(void)
44 {
45 	bool	back	=	false;
46 
47 	{
48 		wxCriticalSectionLocker	lock(csProtect);
49 
50 		if (!(bInUse)) {
51 			bInUse = true;
52 			back = true;
53 		}
54 	}
55 	return back;
56 }
57 
58 
59 void
LeaveCriticalSection(void)60 Dk4WxProcessingController::LeaveCriticalSection(void)
61 {
62 	wxCriticalSectionLocker	lock(csProtect);
63 	bInUse = false;
64 }
65 
66 
67 /* vim: set ai sw=4 ts=4 : */
68