author | unc0rr |
Thu, 10 Dec 2015 23:49:12 +0300 | |
branch | qmlfrontend |
changeset 11456 | 6e9b12864856 |
parent 11455 | 0c75fa9ce340 |
child 11457 | 78860824b5a5 |
permissions | -rw-r--r-- |
10406 | 1 |
unit uFLIPC; |
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
2 |
interface |
10418
091d2c0216c3
Move away from passing shortstrings into C code, now IPC works
unc0rr
parents:
10416
diff
changeset
|
3 |
uses SDLh, uFLTypes; |
10406 | 4 |
|
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
5 |
procedure initIPC; |
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
6 |
procedure freeIPC; |
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
7 |
|
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
8 |
procedure ipcToEngine(s: shortstring); |
10898 | 9 |
procedure ipcToEngineRaw(p: pointer; len: Longword); |
11456 | 10 |
procedure ipcCleanEngineQueue(); |
10420 | 11 |
//function ipcReadFromEngine: shortstring; |
12 |
//function ipcCheckFromEngine: boolean; |
|
10406 | 13 |
|
10935 | 14 |
procedure ipcToNet(s: shortstring); |
15 |
procedure ipcToNetRaw(p: pointer; len: Longword); |
|
16 |
||
10412 | 17 |
procedure ipcToFrontend(s: shortstring); |
10420 | 18 |
procedure ipcToFrontendRaw(p: pointer; len: Longword); |
10412 | 19 |
function ipcReadFromFrontend: shortstring; |
20 |
function ipcCheckFromFrontend: boolean; |
|
21 |
||
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
22 |
procedure registerIPCCallback(p: pointer; f: TIPCCallback); |
10935 | 23 |
procedure registerNetCallback(p: pointer; f: TIPCCallback); |
10416 | 24 |
|
10406 | 25 |
implementation |
26 |
||
10935 | 27 |
var callbackPointerF: pointer; |
28 |
callbackFunctionF: TIPCCallback; |
|
29 |
callbackListenerThreadF: PSDL_Thread; |
|
30 |
callbackPointerN: pointer; |
|
31 |
callbackFunctionN: TIPCCallback; |
|
32 |
callbackListenerThreadN: PSDL_Thread; |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
33 |
queueFrontend, queueEngine, queueNet: PIPCQueue; |
10416 | 34 |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
35 |
procedure ipcSend(var s: TIPCMessage; queue: PIPCQueue); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
36 |
var pmsg: PIPCMessage; |
10412 | 37 |
begin |
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
38 |
SDL_LockMutex(queue^.mut); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
39 |
|
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
40 |
s.next:= nil; |
10418
091d2c0216c3
Move away from passing shortstrings into C code, now IPC works
unc0rr
parents:
10416
diff
changeset
|
41 |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
42 |
if (queue^.msg.next = nil) and (queue^.msg.str[0] = #0) and (queue^.msg.buf = nil) then |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
43 |
begin |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
44 |
queue^.msg:= s; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
45 |
end else |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
46 |
begin |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
47 |
new(pmsg); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
48 |
pmsg^:= s; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
49 |
queue^.last^.next:= pmsg; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
50 |
queue^.last:= pmsg; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
51 |
end; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
52 |
SDL_CondSignal(queue^.cond); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
53 |
SDL_UnlockMutex(queue^.mut); |
10412 | 54 |
end; |
55 |
||
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
56 |
function ipcRead(queue: PIPCQueue): TIPCMessage; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
57 |
var pmsg: PIPCMessage; |
10412 | 58 |
begin |
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
59 |
SDL_LockMutex(queue^.mut); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
60 |
while (queue^.msg.str[0] = #0) and (queue^.msg.buf = nil) and (queue^.msg.next = nil) do |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
61 |
SDL_CondWait(queue^.cond, queue^.mut); |
10412 | 62 |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
63 |
if (queue^.msg.str[0] <> #0) or (queue^.msg.buf <> nil) then |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
64 |
begin |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
65 |
ipcRead:= queue^.msg; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
66 |
queue^.msg.str[0]:= #0; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
67 |
queue^.msg.buf:= nil; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
68 |
end else |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
69 |
begin |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
70 |
pmsg:= queue^.msg.next; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
71 |
ipcRead:= pmsg^; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
72 |
queue^.msg.next:= pmsg^.next; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
73 |
if queue^.msg.next = nil then queue^.last:= @queue^.msg; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
74 |
dispose(pmsg) |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
75 |
end; |
10420 | 76 |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
77 |
SDL_UnlockMutex(queue^.mut) |
10412 | 78 |
end; |
79 |
||
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
80 |
function ipcCheck(queue: PIPCQueue): boolean; |
10412 | 81 |
begin |
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
82 |
SDL_LockMutex(queue^.mut); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
83 |
ipcCheck:= (queue^.msg.str[0] > #0) or (queue^.msg.buf <> nil) or (queue^.msg.next <> nil); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
84 |
SDL_UnlockMutex(queue^.mut) |
10412 | 85 |
end; |
86 |
||
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
87 |
procedure ipcToEngine(s: shortstring); |
10420 | 88 |
var msg: TIPCMessage; |
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
89 |
begin |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
90 |
msg.str:= s; |
10420 | 91 |
msg.buf:= nil; |
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
92 |
ipcSend(msg, queueEngine) |
10412 | 93 |
end; |
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
94 |
|
10412 | 95 |
procedure ipcToFrontend(s: shortstring); |
10420 | 96 |
var msg: TIPCMessage; |
10412 | 97 |
begin |
10420 | 98 |
msg.str:= s; |
99 |
msg.buf:= nil; |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
100 |
ipcSend(msg, queueFrontend) |
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
101 |
end; |
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
102 |
|
11456 | 103 |
procedure ipcCleanEngineQueue(); |
104 |
var pmsg, t: PIPCMessage; |
|
105 |
q: PIPCQueue; |
|
106 |
begin |
|
107 |
q:= queueEngine; |
|
108 |
||
109 |
SDL_LockMutex(q^.mut); |
|
110 |
||
111 |
pmsg:= @q^.msg; |
|
112 |
q^.last:= pmsg; |
|
113 |
||
114 |
while pmsg <> nil do |
|
115 |
begin |
|
116 |
t:= pmsg^.next; |
|
117 |
||
118 |
if pmsg^.buf <> nil then |
|
119 |
FreeMem(pmsg^.buf, pmsg^.len); |
|
120 |
||
121 |
if pmsg <> @q^.msg then |
|
122 |
dispose(pmsg); |
|
123 |
pmsg:= t |
|
124 |
end; |
|
125 |
||
126 |
q^.msg.next:= nil; |
|
127 |
q^.msg.str[0]:= #0; |
|
128 |
q^.msg.buf:= nil; |
|
129 |
||
130 |
SDL_UnlockMutex(q^.mut); |
|
131 |
end; |
|
132 |
||
10935 | 133 |
procedure ipcToNet(s: shortstring); |
134 |
var msg: TIPCMessage; |
|
135 |
begin |
|
136 |
msg.str:= s; |
|
137 |
msg.buf:= nil; |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
138 |
ipcSend(msg, queueNet) |
10935 | 139 |
end; |
140 |
||
10898 | 141 |
procedure ipcToEngineRaw(p: pointer; len: Longword); |
142 |
var msg: TIPCMessage; |
|
143 |
begin |
|
144 |
msg.str[0]:= #0; |
|
145 |
msg.len:= len; |
|
146 |
msg.buf:= GetMem(len); |
|
147 |
Move(p^, msg.buf^, len); |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
148 |
ipcSend(msg, queueEngine) |
10898 | 149 |
end; |
150 |
||
10420 | 151 |
procedure ipcToFrontendRaw(p: pointer; len: Longword); |
152 |
var msg: TIPCMessage; |
|
153 |
begin |
|
154 |
msg.str[0]:= #0; |
|
155 |
msg.len:= len; |
|
156 |
msg.buf:= GetMem(len); |
|
157 |
Move(p^, msg.buf^, len); |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
158 |
ipcSend(msg, queueFrontend) |
10420 | 159 |
end; |
160 |
||
10935 | 161 |
procedure ipcToNetRaw(p: pointer; len: Longword); |
162 |
var msg: TIPCMessage; |
|
163 |
begin |
|
164 |
msg.str[0]:= #0; |
|
165 |
msg.len:= len; |
|
166 |
msg.buf:= GetMem(len); |
|
167 |
Move(p^, msg.buf^, len); |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
168 |
ipcSend(msg, queueNet) |
10935 | 169 |
end; |
170 |
||
10420 | 171 |
function ipcReadFromEngine: TIPCMessage; |
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
172 |
begin |
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
173 |
ipcReadFromEngine:= ipcRead(queueFrontend) |
10412 | 174 |
end; |
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
175 |
|
10412 | 176 |
function ipcReadFromFrontend: shortstring; |
177 |
begin |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
178 |
ipcReadFromFrontend:= ipcRead(queueEngine).str |
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
179 |
end; |
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
180 |
|
10935 | 181 |
function ipcReadToNet: TIPCMessage; |
182 |
begin |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
183 |
ipcReadToNet:= ipcRead(queueNet) |
10935 | 184 |
end; |
185 |
||
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
186 |
function ipcCheckFromEngine: boolean; |
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
187 |
begin |
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
188 |
ipcCheckFromEngine:= ipcCheck(queueFrontend) |
10412 | 189 |
end; |
190 |
||
191 |
function ipcCheckFromFrontend: boolean; |
|
192 |
begin |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
193 |
ipcCheckFromFrontend:= ipcCheck(queueEngine) |
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
194 |
end; |
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
195 |
|
10933 | 196 |
function engineListener(p: pointer): Longint; cdecl; export; |
10420 | 197 |
var msg: TIPCMessage; |
10416 | 198 |
begin |
10933 | 199 |
engineListener:= 0; |
10416 | 200 |
repeat |
10420 | 201 |
msg:= ipcReadFromEngine(); |
202 |
if msg.buf = nil then |
|
10935 | 203 |
callbackFunctionF(callbackPointerF, @msg.str[1], byte(msg.str[0])) |
10420 | 204 |
else |
205 |
begin |
|
10935 | 206 |
callbackFunctionF(callbackPointerF, msg.buf, msg.len); |
207 |
FreeMem(msg.buf, msg.len) |
|
208 |
end |
|
209 |
until false |
|
210 |
end; |
|
211 |
||
212 |
function netListener(p: pointer): Longint; cdecl; export; |
|
213 |
var msg: TIPCMessage; |
|
214 |
begin |
|
215 |
netListener:= 0; |
|
216 |
repeat |
|
217 |
msg:= ipcReadToNet(); |
|
218 |
if msg.buf = nil then |
|
219 |
callbackFunctionN(callbackPointerN, @msg.str[1], byte(msg.str[0])) |
|
220 |
else |
|
221 |
begin |
|
222 |
callbackFunctionN(callbackPointerN, msg.buf, msg.len); |
|
10420 | 223 |
FreeMem(msg.buf, msg.len) |
224 |
end |
|
10416 | 225 |
until false |
226 |
end; |
|
227 |
||
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
228 |
procedure registerIPCCallback(p: pointer; f: TIPCCallback); |
10416 | 229 |
begin |
10935 | 230 |
callbackPointerF:= p; |
231 |
callbackFunctionF:= f; |
|
11408 | 232 |
callbackListenerThreadF:= SDL_CreateThread(@engineListener, 'engineListener', nil); |
10935 | 233 |
end; |
234 |
||
235 |
procedure registerNetCallback(p: pointer; f: TIPCCallback); |
|
236 |
begin |
|
237 |
callbackPointerN:= p; |
|
238 |
callbackFunctionN:= f; |
|
11408 | 239 |
callbackListenerThreadN:= SDL_CreateThread(@netListener, 'netListener', nil); |
10416 | 240 |
end; |
241 |
||
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
242 |
function createQueue: PIPCQueue; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
243 |
var q: PIPCQueue; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
244 |
begin |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
245 |
new(q); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
246 |
q^.msg.str:= ''; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
247 |
q^.msg.buf:= nil; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
248 |
q^.mut:= SDL_CreateMutex; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
249 |
q^.cond:= SDL_CreateCond; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
250 |
q^.msg.next:= nil; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
251 |
q^.last:= @q^.msg; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
252 |
createQueue:= q |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
253 |
end; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
254 |
|
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
255 |
procedure destroyQueue(queue: PIPCQueue); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
256 |
begin |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
257 |
SDL_DestroyCond(queue^.cond); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
258 |
SDL_DestroyMutex(queue^.mut); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
259 |
dispose(queue); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
260 |
end; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
261 |
|
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
262 |
procedure initIPC; |
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
263 |
begin |
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
264 |
queueFrontend:= createQueue; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
265 |
queueEngine:= createQueue; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
266 |
queueNet:= createQueue; |
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
267 |
|
10935 | 268 |
callbackPointerF:= nil; |
269 |
callbackListenerThreadF:= nil; |
|
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
270 |
end; |
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
271 |
|
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
272 |
procedure freeIPC; |
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
273 |
begin |
11408 | 274 |
//FIXME SDL_KillThread(callbackListenerThreadF); |
275 |
//FIXME SDL_KillThread(callbackListenerThreadN); |
|
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
276 |
destroyQueue(queueFrontend); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
277 |
destroyQueue(queueEngine); |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11423
diff
changeset
|
278 |
destroyQueue(queueNet); |
10410
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
279 |
end; |
669bfa55cd70
Some work on new IPC, built with the use of mutexes and condition variables
unc0rr
parents:
10406
diff
changeset
|
280 |
|
10406 | 281 |
end. |