{$include unixstuff.inc}\r
\r
const\r
- absoloutemaxs_select = (sizeof(fdset)*8)-1;\r
+ absolutemaxs_select = (sizeof(fdset)*8)-1;\r
\r
var\r
- fdreverse:array[0..absoloutemaxs_select] of tlasio;\r
+ fdreverse:array[0..absolutemaxs_select] of tlasio;\r
type\r
tselecteventcore=class(teventcore)\r
public\r
\r
procedure processtimers;inline;\r
var\r
- tv ,tvnow : ttimeval ;\r
+ tvnow : ttimeval ;\r
currenttimer : tltimer ;\r
temptimer : tltimer ;\r
\r
begin\r
- gettimeofday(tvnow);\r
+ gettimemonotonic(tvnow);\r
currenttimer := firsttimer;\r
while assigned(currenttimer) do begin\r
//writeln(currenttimer.enabled);\r
procedure processasios(var fdsr,fdsw:fdset);//inline;\r
var\r
currentsocket : tlasio ;\r
- tempsocket : tlasio ;\r
- socketcount : integer ; // for debugging perposes :)\r
+ socketcount : integer ; // for debugging purposes :)\r
dw,bt:integer;\r
currentfdword:fdword;\r
fd : integer;\r
//writeln('entering processasios');\r
{ inc(lcoretestcount);}\r
\r
- //the message loop will exit if all lasio's and ltimer's and lsignal's are destroyed\r
+ //the message loop will exit if all lasios and ltimers and lsignals are destroyed\r
//if (not assigned(firstasin)) and (not assigned(firsttimer)) and (not assigned(firstsignal)) then exit;\r
\r
\r
- sockets which are released may not be freed because theyre never processed by the loop\r
made new code for handling this, using asinreleaseflag\r
\r
- - when/why does the mustrefreshfds select apply, sheck if i did it correctly?\r
+ - when/why does the mustrefreshfds select apply, check if i did it correctly?\r
\r
- what happens if calling handlefdtrigger for a socket which does not have an event\r
}\r
fd_zero(FDSW);\r
if result=-1 then begin\r
if linuxerror = SYS_EINTR then begin\r
- // we received a signal it's not a problem\r
+ // we received a signal it is not a problem\r
end else begin\r
raise esocketexception.create('select returned error '+inttostr(linuxerror));\r
end;\r
\r
repeat\r
\r
- //the message loop will exit if all lasio's and ltimer's and lsignal's are destroyed\r
+ //the message loop will exit if all lasios and ltimers and lsignals are destroyed\r
processtasks;\r
//currenttask := nil;\r
{beware}\r
selectresult := doselect(nil);\r
\r
end else begin\r
- gettimeofday(tvnow);\r
- tv_substract(tv,tvnow);\r
+ gettimemonotonic(tvnow);\r
+ tv_subtract(tv,tvnow);\r
\r
//writeln('timers active');\r
if tv.tv_sec < 0 then begin\r
procedure tselecteventcore.rmasterset(fd : integer;islistensocket : boolean);\r
begin\r
//writeln('rmasterset called with fd ',fd);\r
- if fd > absoloutemaxs then raise esocketexception.create('file discriptor out of range');\r
+ if fd > absolutemaxs then raise esocketexception.create('file descriptor out of range');\r
if fd > maxs then maxs := fd;\r
if fd_isset(fd,fdsrmaster) then exit;\r
fd_set(fd,fdsrmaster);\r
procedure tselecteventcore.wmasterset(fd : integer);\r
begin\r
//writeln('wmasterset called with fd ',fd);\r
- if fd > absoloutemaxs then raise esocketexception.create('file discriptor out of range');\r
+ if fd > absolutemaxs then raise esocketexception.create('file descriptor out of range');\r
if fd > maxs then maxs := fd;\r
\r
if fd_isset(fd,fdswmaster) then exit;\r
inited := true;\r
eventcore := tselecteventcore.create;\r
\r
- absoloutemaxs := absoloutemaxs_select;\r
+ absolutemaxs := absolutemaxs_select;\r
\r
maxs := 0;\r
fd_zero(fdsrmaster);\r