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

Diff of /trunk/lcoreselect.pas

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

revision 1 by plugwash, Fri Mar 28 02:26:58 2008 UTC revision 61 by plugwash, Thu Feb 4 22:47:07 2010 UTC
# Line 21  Line 21 
21    {$ifdef VER1_0}    {$ifdef VER1_0}
22      linux,      linux,
23    {$else}    {$else}
24      baseunix,unix,unixutil,      baseunix,unix,unixutil,sockets,
25    {$endif}    {$endif}
26    fd_utils;    fd_utils;
27  var  var
# Line 31  Line 31 
31  function getfdsrmaster : fdset; {$ifdef useinline}inline;{$endif}  function getfdsrmaster : fdset; {$ifdef useinline}inline;{$endif}
32  function getfdswmaster : fdset; {$ifdef useinline}inline;{$endif}  function getfdswmaster : fdset; {$ifdef useinline}inline;{$endif}
33    
34    procedure lcoreinit;
35    
36  implementation  implementation
37  uses  uses
38    lcore,sysutils,    lcore,sysutils,
39    classes,pgtypes,bfifo,    classes,pgtypes,bfifo,
40    {$ifndef nosignal}    {$ifndef nosignal}
41      lsignal;      lsignal,
42    {$endif}    {$endif}
43      ltimevalstuff;
44    
45  {$include unixstuff.inc}  {$include unixstuff.inc}
46  {$include ltimevalstuff.inc}  
47    const
48      absoloutemaxs_select = (sizeof(fdset)*8)-1;
49    
50  var  var
51    fdreverse:array[0..absoloutemaxs] of tlasio;    fdreverse:array[0..absoloutemaxs_select] of tlasio;
52  type  type
53    tselecteventcore=class(teventcore)    tselecteventcore=class(teventcore)
54      public      public
# Line 78  Line 84 
84      end;      end;
85      temptimer := currenttimer;      temptimer := currenttimer;
86      currenttimer := currenttimer.nexttimer;      currenttimer := currenttimer.nexttimer;
     if temptimer.released then temptimer.free;  
87    end;    end;
88  end;  end;
89    
# Line 129  Line 134 
134      end;      end;
135    end;    end;
136    
   if asinreleaseflag then begin  
     asinreleaseflag := false;  
     currentsocket := firstasin;  
     while assigned(currentsocket) do begin  
       tempsocket := currentsocket;  
       currentsocket := currentsocket.nextasin;  
       if tempsocket.released then begin  
         tempsocket.free;  
       end;  
     end;  
   end;  
137    {    {
138    !!! issues:    !!! issues:
139    - 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
# Line 289  Line 283 
283    repeat    repeat
284    
285      //the message loop will exit if all lasio's and ltimer's and lsignal's are destroyed      //the message loop will exit if all lasio's and ltimer's and lsignal's are destroyed
     if (not assigned(firstasin)) and (not assigned(firsttimer)) {$ifndef nosignal} and (not assigned(firstsignal)){$endif} then exit;  
     {fd_zero(FDSR);  
     fd_zero(FDSW);  
     currentsocket := firstasin;  
     if not assigned(currentsocket) then exit; //the message loop will exit if all lsockets are destroyed  
   
     repeat  
       if (not currentsocket.released) and (currentsocket.state<>wsclosed) then fd_set(currentsocket.fdhandlein,fdsr);  
       if (not currentsocket.released) and (currentsocket.state=wsconnecting) then fd_set(currentsocket.fdhandleout,fdsw);  
       if currentsocket is tlsocket then begin  
          if (not currentsocket.released) and (currentsocket.state=wsconnected) and(tlsocket(currentsocket).sendq <> '') then fd_set(currentsocket.fdhandleout,fdsw);  
       end;  
       tempsocket := currentsocket;  
       currentsocket := currentsocket.nextasin;  
       if tempsocket.released then begin  
         tempsocket.free;  
       end;  
     until not assigned(currentsocket);  
     }  
286      processtasks;      processtasks;
287      //currenttask := nil;      //currenttask := nil;
288      {beware}      {beware}
# Line 388  Line 363 
363    fdreverse[fd] := reverseto;    fdreverse[fd] := reverseto;
364  end;  end;
365    
366    var
367      inited:boolean;
368    
369    procedure lcoreinit;
370  begin  begin
371      if inited then exit;
372      inited := true;
373    eventcore := tselecteventcore.create;    eventcore := tselecteventcore.create;
374    
375      absoloutemaxs := absoloutemaxs_select;
376    
377    maxs := 0;    maxs := 0;
378    fd_zero(fdsrmaster);    fd_zero(fdsrmaster);
379    fd_zero(fdswmaster);    fd_zero(fdswmaster);
380    end;
381    
382  end.  end.

Legend:
Removed from v.1  
changed lines
  Added in v.61

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