{$endif}\r
fd_utils,\r
{$endif}\r
- classes,pgtypes,bfifo;\r
+ classes,pgtypes,bfifo,ltimevalstuff;\r
procedure processtasks;\r
\r
\r
TSendData = procedure (Sender: TObject; BytesSent: Integer) of object;\r
\r
tlcomponent = class(tcomponent)\r
+ private\r
+ procedure releasetaskhandler(wparam,lparam:longint);\r
public\r
- released:boolean;\r
procedure release; virtual;\r
destructor destroy; override;\r
end;\r
onsenddata : tsenddata ;\r
ondatasent : tsocketevent ;\r
//connected : boolean ;\r
- nextasin : tlasio ;\r
- prevasin : tlasio ;\r
\r
recvq : tfifo;\r
OnBgException : TBgExceptionEvent ;\r
var\r
timerwrapperinterface : ttimerwrapperinterface;\r
type\r
- {$ifdef win32}\r
- ttimeval = record\r
- tv_sec : longint;\r
- tv_usec : longint;\r
- end;\r
- {$endif}\r
tltimer=class(tlcomponent)\r
protected\r
\r
procedure exitmessageloop;\r
\r
var\r
- firstasin : tlasio ;\r
firsttimer : tltimer ;\r
firsttask , lasttask , currenttask : tltask ;\r
\r
{$ifndef win32}\r
{$include unixstuff.inc}\r
{$endif}\r
-{$include ltimevalstuff.inc}\r
\r
\r
{!!! added sleep call -beware}\r
inherited destroy;\r
end;\r
\r
-\r
+procedure tlcomponent.releasetaskhandler(wparam,lparam:longint);\r
+begin\r
+ free;\r
+end;\r
\r
\r
procedure tlcomponent.release;\r
begin\r
- released := true;\r
+ addtask(releasetaskhandler,self,0,0);\r
end;\r
\r
procedure tlasio.release;\r
state := wsclosed;\r
fdhandlein := -1;\r
fdhandleout := -1;\r
- nextasin := firstasin;\r
- prevasin := nil;\r
- if assigned(nextasin) then nextasin.prevasin := self;\r
- firstasin := self;\r
-\r
- released := false;\r
end;\r
\r
destructor tlasio.destroy;\r
begin\r
destroying := true;\r
if state <> wsclosed then close;\r
- if prevasin <> nil then begin\r
- prevasin.nextasin := nextasin;\r
- end else begin\r
- firstasin := nextasin;\r
- end;\r
- if nextasin <> nil then begin\r
- nextasin.prevasin := prevasin;\r
- end;\r
recvq.free;\r
sendq.free;\r
inherited destroy;\r
// fdstestr : fdset;\r
// fdstestw : fdset;\r
begin\r
- if state <> wsconnected then exit;\r
+ if state <> wsconnected then begin\r
+ result := -1;\r
+ exit;\r
+ end;\r
\r
lensent := sendq.get(data,packetbasesize*2);\r
if assigned(data) then result := myfdwrite(fdhandleout,data^,lensent) else result := 0;\r
end;\r
interval := 1000;\r
enabled := true;\r
- released := false;\r
-\r
end;\r
\r
destructor tltimer.destroy;\r
\r
\r
begin\r
- firstasin := nil;\r
firsttask := nil;\r
\r
\r