]> git.lyx.org Git - lyx.git/blob - src/support/syssingleton.C
merge from the string-switch branch and ready for a prelease.
[lyx.git] / src / support / syssingleton.C
1 #include <config.h>
2
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include <sys/wait.h>
6 #include "syscontr.h"
7
8
9 //----------------------------------------------------------------------
10 // Ensure, that only one controller exist inside process
11 //----------------------------------------------------------------------
12
13 // global controller variable
14 SystemcallsSingletoncontroller *
15 SystemcallsSingletoncontroller::Startcontroller::
16 contr = 0;
17
18 // reference count
19 int SystemcallsSingletoncontroller::Startcontroller::
20 refcount = 0;
21
22 // default constructor. 
23 // Nothing to do at moment.
24 SystemcallsSingletoncontroller::Startcontroller::
25 Startcontroller() 
26 {
27 }
28
29 // default destructor.
30 // Nothing to do at moment
31 SystemcallsSingletoncontroller::Startcontroller::
32 ~Startcontroller() 
33 {
34 }
35
36 // Give reference to global controller-instance
37 // 
38 SystemcallsSingletoncontroller *
39 SystemcallsSingletoncontroller::Startcontroller::
40 GetController()
41
42         if (! contr) 
43                 { // generate the global controller
44                         contr = new SystemcallsSingletoncontroller;
45                 }
46         refcount++;
47         return contr;
48 }