Does the syncobjs unit in the FCL need to be machine dependent any more?
The functionality seems to be in the thread manager for all the
platforms that have threads, and I had some problems using the unit.
(TRTLCriticalSection is defined in sybcobjs and as part of the system
thread stuff). The attached patch shows what I had in mind - delete all
the syncobjs.pp files in the platform directories.
Colin
diff -uNr --exclude=.svn --exclude=fpc.spec trunk/fpcsrc/fcl/inc/syncobh.inc trunk.w/fpcsrc/fcl/inc/syncobh.inc
--- trunk/fpcsrc/fcl/inc/syncobh.inc 2005-10-04 20:57:24.000000000 +0100
+++ trunk.w/fpcsrc/fcl/inc/syncobh.inc 2006-11-25 13:54:24.000000000 +0000
@@ -44,9 +44,7 @@
TEventObject = class(THandleObject)
private
- FSem: Pointer;
FManualReset: Boolean;
- FEventSection: TCriticalSection;
public
constructor Create(EventAttributes : PSecurityAttributes;
AManualReset,InitialState : Boolean;const Name : string);
diff -uNr --exclude=.svn --exclude=fpc.spec trunk/fpcsrc/fcl/inc/syncobjs.pp trunk.w/fpcsrc/fcl/inc/syncobjs.pp
--- trunk/fpcsrc/fcl/inc/syncobjs.pp 1970-01-01 01:00:00.000000000 +0100
+++ trunk.w/fpcsrc/fcl/inc/syncobjs.pp 2006-11-25 13:59:05.000000000 +0000
@@ -0,0 +1,113 @@
+{
+ This file is part of the Free Component Library (FCL)
+ Copyright (c) 1998 by Florian Klaempfl
+ member of the Free Pascal development team
+
+ See the file COPYING.FPC, included in this distribution,
+ for details about the copyright.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$mode objfpc}
+{$h+}
+unit syncobjs;
+
+interface
+
+uses
+ sysutils;
+
+type
+ PSecurityAttributes = Pointer;
+ TEventHandle = Pointer;
+ // TRTLCriticalSection = TPthreadMutex;
+
+const
+ INFINITE = Cardinal(-1);
+
+{$I syncobh.inc}
+
+implementation
+
+{ ---------------------------------------------------------------------
+ Real syncobjs implementation
+ ---------------------------------------------------------------------}
+
+{$I syncob.inc}
+
+
+procedure TCriticalSection.Acquire;
+
+begin
+ EnterCriticalSection(CriticalSection);
+end;
+
+procedure TCriticalSection.Release;
+
+begin
+ LeaveCriticalSection(CriticalSection);
+end;
+
+constructor TCriticalSection.Create;
+
+begin
+ Inherited Create;
+ InitCriticalSection(CriticalSection);
+end;
+
+destructor TCriticalSection.Destroy;
+
+begin
+ DoneCriticalSection(CriticalSection);
+end;
+
+destructor THandleObject.destroy;
+
+begin
+end;
+
+constructor TEventObject.Create(EventAttributes : PSecurityAttributes;
+ AManualReset,InitialState : Boolean;const Name : string);
+
+begin
+ FHandle := BasicEventCreate(EventAttributes, AManualReset, InitialState, Name);
+ FManualReset:=AManualReset;
+end;
+
+destructor TEventObject.destroy;
+
+begin
+ BasicEventDestroy(Handle);
+end;
+
+procedure TEventObject.ResetEvent;
+
+begin
+ BasicEventResetEvent(Handle);
+end;
+
+procedure TEventObject.SetEvent;
+
+begin
+ BasicEventSetEvent(Handle);
+end;
+
+
+function TEventObject.WaitFor(Timeout : Cardinal) : TWaitResult;
+
+begin
+ Result := TWaitResult(basiceventWaitFor(Timeout, Handle));
+ if Result = wrError then
+ FLastError := GetLastOSError;
+end;
+
+constructor TSimpleEvent.Create;
+
+begin
+ inherited Create(nil, True, False, '');
+end;
+
+end.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel