hedgewars/uFLIPC.pas
branchqmlfrontend
changeset 11460 9f2fb0031ef0
parent 11459 30397f91571c
child 12858 0c6fb706f747
equal deleted inserted replaced
11459:30397f91571c 11460:9f2fb0031ef0
    49         new(pmsg);
    49         new(pmsg);
    50         pmsg^:= s;
    50         pmsg^:= s;
    51         queue^.last^.next:= pmsg;
    51         queue^.last^.next:= pmsg;
    52         queue^.last:= pmsg;
    52         queue^.last:= pmsg;
    53     end;
    53     end;
       
    54 
    54     SDL_CondSignal(queue^.cond);
    55     SDL_CondSignal(queue^.cond);
    55     SDL_UnlockMutex(queue^.mut);
    56     SDL_UnlockMutex(queue^.mut);
    56 end;
    57 end;
    57 
    58 
    58 function ipcRead(queue: PIPCQueue): TIPCMessage;
    59 function ipcRead(queue: PIPCQueue): TIPCMessage;
   127     q:= queueEngine;
   128     q:= queueEngine;
   128 
   129 
   129     SDL_LockMutex(q^.mut);
   130     SDL_LockMutex(q^.mut);
   130 
   131 
   131     pmsg:= @q^.msg;
   132     pmsg:= @q^.msg;
   132 write('    ipcRemoveBarrierFromEngineQueue: ');
       
   133     while pmsg <> nil do
   133     while pmsg <> nil do
   134     begin
   134     begin
   135         write('.');
       
   136         t:= pmsg^.next;
   135         t:= pmsg^.next;
   137         q^.msg.next:= t;
   136         q^.msg.next:= t;
   138 
   137 
   139         pmsg^.str[0]:= #0;
   138         pmsg^.str[0]:= #0;
   140         if pmsg^.buf <> nil then
   139         if pmsg^.buf <> nil then
   164                 t:= nil
   163                 t:= nil
   165             end;
   164             end;
   166 
   165 
   167         pmsg:= t
   166         pmsg:= t
   168     end;
   167     end;
   169 writeln;
   168 
   170     if q^.msg.next = nil then q^.last:= @q^.msg;
   169     if q^.msg.next = nil then q^.last:= @q^.msg;
   171 
   170 
   172     q^.msg.str[0]:= #0;
   171     q^.msg.str[0]:= #0;
   173     q^.msg.buf:= nil;
   172     q^.msg.buf:= nil;
   174 
   173 
   288 var q: PIPCQueue;
   287 var q: PIPCQueue;
   289 begin
   288 begin
   290     new(q);
   289     new(q);
   291     q^.msg.str:= '';
   290     q^.msg.str:= '';
   292     q^.msg.buf:= nil;
   291     q^.msg.buf:= nil;
       
   292     q^.msg.barrier:= 0;
   293     q^.mut:= SDL_CreateMutex;
   293     q^.mut:= SDL_CreateMutex;
   294     q^.cond:= SDL_CreateCond;
   294     q^.cond:= SDL_CreateCond;
   295     q^.msg.next:= nil;
   295     q^.msg.next:= nil;
   296     q^.last:= @q^.msg;
   296     q^.last:= @q^.msg;
   297     createQueue:= q
   297     createQueue:= q