X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/4782a5c5afee47721cc617daa40dd29828342c2b..be01aa2e4e4e54fd8bb3ea27ac3c6b7978553b6e:/lcoreselect.pas diff --git a/lcoreselect.pas b/lcoreselect.pas index e0351eb..16134ee 100755 --- a/lcoreselect.pas +++ b/lcoreselect.pas @@ -6,12 +6,12 @@ For conditions of distribution and use, see copyright notice in zlib_license.txt which is included in the package ----------------------------------------------------------------------------- } - -{$ifdef fpc} - {$ifndef ver1_0} - {$define useinline} - {$endif} -{$endif} + +{$ifdef fpc} + {$ifndef ver1_0} + {$define useinline} + {$endif} +{$endif} unit lcoreselect; @@ -31,6 +31,8 @@ var function getfdsrmaster : fdset; {$ifdef useinline}inline;{$endif} function getfdswmaster : fdset; {$ifdef useinline}inline;{$endif} +procedure lcoreinit; + implementation uses lcore,sysutils, @@ -41,8 +43,12 @@ uses {$include unixstuff.inc} {$include ltimevalstuff.inc} + +const + absoloutemaxs_select = (sizeof(fdset)*8)-1; + var - fdreverse:array[0..absoloutemaxs] of tlasio; + fdreverse:array[0..absoloutemaxs_select] of tlasio; type tselecteventcore=class(teventcore) public @@ -209,7 +215,7 @@ var var fdsrmaster , fdswmaster : fdset ; - + function getfdsrmaster : fdset; {$ifdef fpc}inline;{$endif} begin result := fdsrmaster; @@ -218,8 +224,8 @@ function getfdswmaster : fdset; {$ifdef fpc}inline;{$endif} begin result := fdswmaster; end; - - + + Function doSelect(timeOut:PTimeVal):longint;//inline; var localtimeval : ttimeval; @@ -388,12 +394,20 @@ begin fdreverse[fd] := reverseto; end; +var + inited:boolean; - +procedure lcoreinit; begin + if inited then exit; + inited := true; eventcore := tselecteventcore.create; + absoloutemaxs := absoloutemaxs_select; + maxs := 0; fd_zero(fdsrmaster); fd_zero(fdswmaster); +end; + end.