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

Diff of /trunk/lcoreselect.pas

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

revision 135 by beware, Thu Mar 13 21:27:50 2014 UTC revision 136 by beware, Fri Mar 28 03:18:52 2014 UTC
# Line 45  Line 45 
45  {$include unixstuff.inc}  {$include unixstuff.inc}
46    
47  const  const
48    absoloutemaxs_select = (sizeof(fdset)*8)-1;    absolutemaxs_select = (sizeof(fdset)*8)-1;
49    
50  var  var
51    fdreverse:array[0..absoloutemaxs_select] of tlasio;    fdreverse:array[0..absolutemaxs_select] of tlasio;
52  type  type
53    tselecteventcore=class(teventcore)    tselecteventcore=class(teventcore)
54      public      public
# Line 90  Line 90 
90  procedure processasios(var fdsr,fdsw:fdset);//inline;  procedure processasios(var fdsr,fdsw:fdset);//inline;
91  var  var
92    currentsocket : tlasio  ;    currentsocket : tlasio  ;
93    socketcount   : integer ; // for debugging perposes :)    socketcount   : integer ; // for debugging purposes :)
94    dw,bt:integer;    dw,bt:integer;
95    currentfdword:fdword;    currentfdword:fdword;
96    fd : integer;    fd : integer;
# Line 98  Line 98 
98    //writeln('entering processasios');    //writeln('entering processasios');
99  {  inc(lcoretestcount);}  {  inc(lcoretestcount);}
100    
101      //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
102      //if (not assigned(firstasin)) and (not assigned(firsttimer)) and (not assigned(firstsignal)) then exit;      //if (not assigned(firstasin)) and (not assigned(firsttimer)) and (not assigned(firstsignal)) then exit;
103    
104    
# Line 144  Line 144 
144    - sockets which are released may not be freed because theyre never processed by the loop    - sockets which are released may not be freed because theyre never processed by the loop
145    made new code for handling this, using asinreleaseflag    made new code for handling this, using asinreleaseflag
146    
147    - 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?
148    
149    - what happens if calling handlefdtrigger for a socket which does not have an event    - what happens if calling handlefdtrigger for a socket which does not have an event
150    }    }
# Line 288  Line 288 
288    
289    repeat    repeat
290    
291      //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
292      processtasks;      processtasks;
293      //currenttask := nil;      //currenttask := nil;
294      {beware}      {beware}
# Line 310  Line 310 
310    
311      end else begin      end else begin
312        gettimeofday(tvnow);        gettimeofday(tvnow);
313        tv_substract(tv,tvnow);        tv_subtract(tv,tvnow);
314    
315        //writeln('timers active');        //writeln('timers active');
316        if tv.tv_sec < 0 then begin        if tv.tv_sec < 0 then begin
# Line 334  Line 334 
334  procedure tselecteventcore.rmasterset(fd : integer;islistensocket : boolean);  procedure tselecteventcore.rmasterset(fd : integer;islistensocket : boolean);
335  begin  begin
336    //writeln('rmasterset called with fd ',fd);    //writeln('rmasterset called with fd ',fd);
337    if fd > absoloutemaxs then raise esocketexception.create('file discriptor out of range');    if fd > absolutemaxs then raise esocketexception.create('file descriptor out of range');
338    if fd > maxs then maxs := fd;    if fd > maxs then maxs := fd;
339    if fd_isset(fd,fdsrmaster) then exit;    if fd_isset(fd,fdsrmaster) then exit;
340    fd_set(fd,fdsrmaster);    fd_set(fd,fdsrmaster);
# Line 353  Line 353 
353  procedure tselecteventcore.wmasterset(fd : integer);  procedure tselecteventcore.wmasterset(fd : integer);
354  begin  begin
355    //writeln('wmasterset called with fd ',fd);    //writeln('wmasterset called with fd ',fd);
356    if fd > absoloutemaxs then raise esocketexception.create('file discriptor out of range');    if fd > absolutemaxs then raise esocketexception.create('file descriptor out of range');
357    if fd > maxs then maxs := fd;    if fd > maxs then maxs := fd;
358    
359    if fd_isset(fd,fdswmaster) then exit;    if fd_isset(fd,fdswmaster) then exit;
# Line 382  Line 382 
382    inited := true;    inited := true;
383    eventcore := tselecteventcore.create;    eventcore := tselecteventcore.create;
384    
385    absoloutemaxs := absoloutemaxs_select;    absolutemaxs := absolutemaxs_select;
386    
387    maxs := 0;    maxs := 0;
388    fd_zero(fdsrmaster);    fd_zero(fdsrmaster);

Legend:
Removed from v.135  
changed lines
  Added in v.136

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