X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/03b75b4c964d8b3ac97d4007f0e033549b01c92f..a77cd534c22418ec9a8a22ae42efef1a9500b193:/lcoreselect.pas?ds=sidebyside diff --git a/lcoreselect.pas b/lcoreselect.pas index 38da6ba..ad81600 100644 --- a/lcoreselect.pas +++ b/lcoreselect.pas @@ -45,10 +45,10 @@ uses {$include unixstuff.inc} const - absoloutemaxs_select = (sizeof(fdset)*8)-1; + absolutemaxs_select = (sizeof(fdset)*8)-1; var - fdreverse:array[0..absoloutemaxs_select] of tlasio; + fdreverse:array[0..absolutemaxs_select] of tlasio; type tselecteventcore=class(teventcore) public @@ -69,7 +69,7 @@ var temptimer : tltimer ; begin - gettimeofday(tvnow); + gettimemonotonic(tvnow); currenttimer := firsttimer; while assigned(currenttimer) do begin //writeln(currenttimer.enabled); @@ -90,7 +90,7 @@ end; procedure processasios(var fdsr,fdsw:fdset);//inline; var currentsocket : tlasio ; - socketcount : integer ; // for debugging perposes :) + socketcount : integer ; // for debugging purposes :) dw,bt:integer; currentfdword:fdword; fd : integer; @@ -98,7 +98,7 @@ begin //writeln('entering processasios'); { inc(lcoretestcount);} - //the message loop will exit if all lasio's and ltimer's and lsignal's are destroyed + //the message loop will exit if all lasios and ltimers and lsignals are destroyed //if (not assigned(firstasin)) and (not assigned(firsttimer)) and (not assigned(firstsignal)) then exit; @@ -144,7 +144,7 @@ begin - sockets which are released may not be freed because theyre never processed by the loop made new code for handling this, using asinreleaseflag - - when/why does the mustrefreshfds select apply, sheck if i did it correctly? + - when/why does the mustrefreshfds select apply, check if i did it correctly? - what happens if calling handlefdtrigger for a socket which does not have an event } @@ -190,7 +190,7 @@ begin prepsigpipe; {$endif} selectresult := select(maxs+1,@fdsr,@fdsw,nil,0); - while (selectresult>0) or assigned(firsttask) or assigned(currenttask) do begin; + while (selectresult>0) or assigned(firsttask) do begin; processtasks; processtimers; @@ -249,7 +249,7 @@ begin fd_zero(FDSW); if result=-1 then begin if linuxerror = SYS_EINTR then begin - // we received a signal it's not a problem + // we received a signal it is not a problem end else begin raise esocketexception.create('select returned error '+inttostr(linuxerror)); end; @@ -288,7 +288,7 @@ begin repeat - //the message loop will exit if all lasio's and ltimer's and lsignal's are destroyed + //the message loop will exit if all lasios and ltimers and lsignals are destroyed processtasks; //currenttask := nil; {beware} @@ -309,8 +309,8 @@ begin selectresult := doselect(nil); end else begin - gettimeofday(tvnow); - tv_substract(tv,tvnow); + gettimemonotonic(tvnow); + tv_subtract(tv,tvnow); //writeln('timers active'); if tv.tv_sec < 0 then begin @@ -334,7 +334,7 @@ end; procedure tselecteventcore.rmasterset(fd : integer;islistensocket : boolean); begin //writeln('rmasterset called with fd ',fd); - if fd > absoloutemaxs then raise esocketexception.create('file discriptor out of range'); + if fd > absolutemaxs then raise esocketexception.create('file descriptor out of range'); if fd > maxs then maxs := fd; if fd_isset(fd,fdsrmaster) then exit; fd_set(fd,fdsrmaster); @@ -353,7 +353,7 @@ end; procedure tselecteventcore.wmasterset(fd : integer); begin //writeln('wmasterset called with fd ',fd); - if fd > absoloutemaxs then raise esocketexception.create('file discriptor out of range'); + if fd > absolutemaxs then raise esocketexception.create('file descriptor out of range'); if fd > maxs then maxs := fd; if fd_isset(fd,fdswmaster) then exit; @@ -382,7 +382,7 @@ begin inited := true; eventcore := tselecteventcore.create; - absoloutemaxs := absoloutemaxs_select; + absolutemaxs := absolutemaxs_select; maxs := 0; fd_zero(fdsrmaster);