/[lcore]/trunk/lcoremessages.pas
ViewVC logotype

Diff of /trunk/lcoremessages.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 156 by plugwash, Sun Sep 10 20:02:13 2017 UTC revision 157 by beware, Fri Aug 13 03:52:55 2021 UTC
# Line 389  Line 389 
389    result64: integer;    result64: integer;
390    tv : ttimeval;    tv : ttimeval;
391  begin  begin
392    gettimeofday(tv);    gettimemonotonic(tv);
393    result64 := (tv.tv_sec*1000)+(tv.tv_usec div 1000);    result64 := (tv.tv_sec*1000)+(tv.tv_usec div 1000);
394    result := result64;    result := result64;
395  end;  end;
# Line 451  Line 451 
451      threaddata := findthreaddata(tm.GetCurrentThreadId);      threaddata := findthreaddata(tm.GetCurrentThreadId);
452      if threaddata.lcorethread then raise exception.create('get/peek message cannot be used in the lcore thread');      if threaddata.lcorethread then raise exception.create('get/peek message cannot be used in the lcore thread');
453      message := threaddata.messagequeue;      message := threaddata.messagequeue;
454      gettimeofday(nowtv);      gettimemonotonic(nowtv);
455      while (not peek) and (message=nil) and (not tv_compare(nowtv,threaddata.nexttimer)) do begin      while (not peek) and (message=nil) and (not tv_compare(nowtv,threaddata.nexttimer)) do begin
456        threaddata.waiting := true;        threaddata.waiting := true;
457        structurelock.release;        structurelock.release;
# Line 461  Line 461 
461    
462          timeouttv := threaddata.nexttimer;          timeouttv := threaddata.nexttimer;
463          timeoutms := (timeouttv.tv_sec * 1000)+(timeouttv.tv_usec div 1000);          timeoutms := (timeouttv.tv_sec * 1000)+(timeouttv.tv_usec div 1000);
464          //i'm assuming the timeout is in milliseconds          //i am assuming the timeout is in milliseconds
465          if (timeoutms > maxlongint) then timeoutms := maxlongint;          if (timeoutms > maxlongint) then timeoutms := maxlongint;
466          threaddata.messageevent.waitfor(timeoutms);          threaddata.messageevent.waitfor(timeoutms);
467    
# Line 469  Line 469 
469        structurelock.acquire;        structurelock.acquire;
470        threaddata.waiting := false;        threaddata.waiting := false;
471        message := threaddata.messagequeue;        message := threaddata.messagequeue;
472        gettimeofday(nowtv);        gettimemonotonic(nowtv);
473      end;      end;
474      if (message=nil) and tv_compare(nowtv,threaddata.nexttimer) then begin      if (message=nil) and tv_compare(nowtv,threaddata.nexttimer) then begin
475        processtimers;        processtimers;

Legend:
Removed from v.156  
changed lines
  Added in v.157

No admin address has been configured">No admin address has been configured
ViewVC Help
Powered by ViewVC 1.1.26