+ Async moved from package to FCL

This commit is contained in:
michael 2003-03-17 22:25:32 +00:00
parent bb15f5641e
commit 0ad4bad79c
3 changed files with 36 additions and 36 deletions

View File

@ -217,7 +217,7 @@ override PACKAGE_VERSION=1.0.6
override TARGET_DIRS+=xml db shedit passrc
override TARGET_UNITS+=classes contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream zstream cachecls xmlreg registry eventlog
ifeq ($(OS_TARGET),linux)
override TARGET_UNITS+=process asyncio resolve ssockets http
override TARGET_UNITS+=process asyncio resolve ssockets http fpasync
endif
ifeq ($(OS_TARGET),win32)
override TARGET_UNITS+=process fileinfo resolve ssockets
@ -826,6 +826,7 @@ ifeq ($(OS_TARGET),linux)
REQUIRE_PACKAGES_RTL=1
REQUIRE_PACKAGES_PASZLIB=1
REQUIRE_PACKAGES_NETDB=1
REQUIRE_PACKAGES_LIBASYNC=1
REQUIRE_PACKAGES_MYSQL=1
REQUIRE_PACKAGES_IBASE=1
endif
@ -971,6 +972,32 @@ ifdef UNITDIR_NETDB
override COMPILER_UNITDIR+=$(UNITDIR_NETDB)
endif
endif
ifdef REQUIRE_PACKAGES_LIBASYNC
PACKAGEDIR_LIBASYNC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /libasync/Makefile.fpc,$(PACKAGESDIR))))))
ifneq ($(PACKAGEDIR_LIBASYNC),)
ifneq ($(wildcard $(PACKAGEDIR_LIBASYNC)/$(OS_TARGET)),)
UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC)/$(OS_TARGET)
else
UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC)
endif
ifdef CHECKDEPEND
$(PACKAGEDIR_LIBASYNC)/$(FPCMADE):
$(MAKE) -C $(PACKAGEDIR_LIBASYNC) $(FPCMADE)
override ALLDEPENDENCIES+=$(PACKAGEDIR_LIBASYNC)/$(FPCMADE)
endif
else
PACKAGEDIR_LIBASYNC=
UNITDIR_LIBASYNC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /libasync/Package.fpc,$(UNITSDIR)))))
ifneq ($(UNITDIR_LIBASYNC),)
UNITDIR_LIBASYNC:=$(firstword $(UNITDIR_LIBASYNC))
else
UNITDIR_LIBASYNC=
endif
endif
ifdef UNITDIR_LIBASYNC
override COMPILER_UNITDIR+=$(UNITDIR_LIBASYNC)
endif
endif
ifdef REQUIRE_PACKAGES_MYSQL
PACKAGEDIR_MYSQL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))))
ifneq ($(PACKAGEDIR_MYSQL),)

View File

@ -8,7 +8,7 @@ version=1.0.6
[require]
packages=paszlib
packages_linux=netdb
packages_linux=netdb libasync
packages_freebsd=netdb
packages_netbsd=netdb
packages_openbsd=netdb
@ -24,7 +24,7 @@ units=classes contnrs inifiles ezcgi pipes rtfpars idea base64 gettext iostream
units_freebsd=process asyncio ssockets http resolve http
units_netbsd=process asyncio ssockets http resolve http
units_openbsd=process asyncio ssockets http resolve http
units_linux=process asyncio resolve ssockets http
units_linux=process asyncio resolve ssockets http fpasync
units_win32=process fileinfo resolve ssockets
rsts=classes ssockets cachecls resolve
exampledirs=tests

View File

@ -2,9 +2,11 @@
$Id$
fpAsync: Asynchronous event management for Free Pascal
Copyright (C) 2001-2003 by
Copyright (C) 2001-2002 by
Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org
Unix implementation
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
@ -174,7 +176,6 @@ type
FDataStream: TStream;
FBlockingStream: THandleStream;
NotifyHandle: Pointer;
DoStopAndFree: Boolean;
function DoRealWrite(const ABuffer; Count: Integer): Integer; override;
procedure WritingFailed; override;
@ -186,7 +187,6 @@ type
constructor Create(AEventLoop: TEventLoop;
ADataStream: TStream; ABlockingStream: THandleStream);
destructor Destroy; override;
procedure StopAndFree; // Destroy instance after run
property EventLoop: TEventLoop read FEventLoop;
property DataStream: TStream read FDataStream;
@ -194,12 +194,6 @@ type
end;
var
{ All data written to a TWriteBuffer or descendant class will be written to
this stream as well: }
fpAsyncWriteBufferDebugStream: TStream;
implementation
type
@ -595,16 +589,13 @@ end;
destructor TAsyncStreamLineReader.Destroy;
begin
if Assigned(NotifyHandle) then
EventLoop.ClearDataAvailableNotify(NotifyHandle);
inherited Destroy;
end;
procedure TAsyncStreamLineReader.StopAndFree;
begin
if Assigned(NotifyHandle) then
begin
EventLoop.ClearDataAvailableNotify(NotifyHandle);
NotifyHandle := nil;
end;
DoStopAndFree := True;
end;
@ -683,8 +674,6 @@ begin
ReallocMem(FBuffer, FBytesInBuffer + Count);
Move(ABuffer, FBuffer[FBytesInBuffer], Count);
Inc(FBytesInBuffer, Count);
if Assigned(fpAsyncWriteBufferDebugStream) then
fpAsyncWriteBufferDebugStream.Write(ABuffer, Count);
WantWrite;
Result := Count;
end;
@ -768,8 +757,6 @@ end;
procedure TAsyncWriteStream.CanWrite(UserData: TObject);
begin
Run;
if DoStopAndFree then
Free;
end;
constructor TAsyncWriteStream.Create(AEventLoop: TEventLoop;
@ -796,27 +783,13 @@ begin
inherited Destroy;
end;
procedure TAsyncWriteStream.StopAndFree;
begin
if Assigned(NotifyHandle) then
begin
EventLoop.ClearCanWriteNotify(NotifyHandle);
NotifyHandle := nil;
end;
DoStopAndFree := True;
end;
end.
{
$Log$
Revision 1.2 2002-04-25 19:12:27 sg
* Added ability to write all write buffer data to an debug stream
* Added TAsyncWriteStream.StopAndFree
Revision 1.1 2003/03/17 22:25:32 michael
Revision 1.1 2003-03-17 22:25:32 michael
+ Async moved from package to FCL
Revision 1.3 2002/09/15 15:45:38 sg