ThreadManagement class added to store and use all mutex/signal
[scilab.git] / scilab / modules / ast / includes / system_env / threadmanagement.hxx
1 /*
2 *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 *  Copyright (C) 2015 - Scilab-Enterprises - Cedric Delamarre
4 *
5 *  This file must be used under the terms of the CeCILL.
6 *  This source file is licensed as described in the file COPYING, which
7 *  you should have received as part of this distribution.  The terms
8 *  are also available at
9 *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10 *
11 */
12
13 #ifndef __THREADMANAGEMENT_HXX__
14 #define __THREADMANAGEMENT_HXX__
15
16 extern "C"
17 {
18 #include "Thread_Wrapper.h"
19 #include "dynamiclibrary.h"
20 #include "dynlib_ast.h"
21 }
22
23 class EXTERN_AST ThreadManagement
24 {
25 private :
26     static __threadLock m_RunnerLock;
27     static __threadLock m_StartLock;
28     static __threadLock m_ParseLock;
29     static __threadLock m_StoreCommandLock;
30
31     static __threadSignal m_ConsoleExecDone;
32     static __threadSignalLock m_ConsoleExecDoneLock;
33
34     static __threadSignal m_AwakeRunner;
35     static __threadSignalLock m_AwakeRunnerLock;
36
37     static __threadSignal m_AstPending;
38     static __threadSignalLock m_AstPendingLock;
39
40     static __threadSignal m_StartPending;
41     static __threadSignalLock m_StartPendingLock;
42
43     static __threadSignal m_CommandStored;
44     static __threadSignalLock m_CommandStoredLock;
45
46
47 public :
48
49     static void initialize(void);
50
51     static void LockStart(void);
52     static void UnlockStart(void);
53     static void LockParser(void);
54     static void UnlockParser(void);
55     static void LockStoreCommand(void);
56     static void UnlockStoreCommand(void);
57     static void LockRunner(void);
58     static void UnlockRunner(void);
59
60     static void SendAstPendingSignal(void);
61     static void WaitForAstPendingSignal(void);
62     static void SendConsoleExecDoneSignal(void);
63     static void WaitForConsoleExecDoneSignal(void);
64     static void SendAwakeRunnerSignal(void);
65     static void WaitForAwakeRunnerSignal(void);
66     static void SendStartPendingSignal(void);
67     static void WaitForStartPendingSignal(void);
68     static void SendCommandStoredSignal(void);
69     static void WaitForCommandStoredSignal(void);
70
71 };
72
73 #endif /* !__THREADMANAGEMENT_HXX__ */