Vuo  2.3.2
VuoRuntimePersistentState.cc
Go to the documentation of this file.
1 
11 
12 #include "VuoCompositionDiff.hh"
13 #include "VuoNodeRegistry.hh"
16 #include "VuoRuntimeState.hh"
17 #include "VuoThreadManager.hh"
18 
23 {
24  this->workingDirectory = (strlen(workingDirectory) > 0 ? workingDirectory : getCurrentWorkingDirectory());
25 
26  lastEventId = 0;
27 
28  _isStopRequested = false;
29 
30  finiCallbackQueue = dispatch_queue_create("org.vuo.runtime.finiCallback", NULL);
31 
32  triggerWorkersScheduled = dispatch_group_create();
33 
35  nodeRegistry = new VuoNodeRegistry(this);
39 }
40 
45 {
46  dispatch_release(finiCallbackQueue);
47  dispatch_release(triggerWorkersScheduled);
48 
49  delete compositionDiff;
50  delete nodeRegistry;
51  delete communicator;
52  delete threadManager;
53  delete nodeSynchronization;
54 }
55 
60 {
61  // Keep consistent with VuoGetWorkingDirectory().
62  char currentWorkingDirectory[PATH_MAX+1];
63  getcwd(currentWorkingDirectory, PATH_MAX+1);
64  return currentWorkingDirectory;
65 }
66 
71 {
72  return strdup(workingDirectory.c_str());
73 }
74 
79 {
80  return __sync_add_and_fetch(&lastEventId, 1);
81 }
82 
87 {
88  return _isStopRequested;
89 }
90 
95 {
96  _isStopRequested = isStopRequested;
97 }
98 
103 {
104  dispatch_sync(finiCallbackQueue, ^{
105  finiCallbacks.push_back(fini);
106  });
107 }
108 
113 {
114  dispatch_sync(finiCallbackQueue, ^{
115  VuoCompositionState compositionState = { (void *)runtimeState, "" };
117 
118  for (vector<VuoCompositionFiniCallback>::iterator i = finiCallbacks.begin(); i != finiCallbacks.end(); ++i)
119  (*i)();
120 
122  });
123 }
124 
130 {
131  return triggerWorkersScheduled;
132 }
133 
134 extern "C"
135 {
136 
140 unsigned long vuoGetNextEventId(VuoCompositionState *compositionState)
141 {
144 }
145 
149 dispatch_group_t vuoGetTriggerWorkersScheduled(VuoCompositionState *compositionState)
150 {
153 }
154 
155 }