Recent

Author Topic: Synch module version 1.0 ...  (Read 16011 times)

aminer

  • Hero Member
  • *****
  • Posts: 956
Synch module version 1.0 ...
« on: April 22, 2010, 11:53:26 pm »

Hello,


Synch module version 1.0


Description:

Synch module supports Windows,Mac OSX, Linux and Unix...

and the following have been added to the Synch module:

TCriticalSection,TMutex,TSimpleEvent,TSemaphore,TMultiReadExclusiveWrite.


Note: With TMultiReadExclusiveWrite you can give preference to the reader or writer.


Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/

Operating Systems: Windows, Mac OSX , Linux , Unix...


Required FPC switches: -O3 -Sd -dFPC -dFreePascal

-Sd for delphi mode....

-dUnix for Unix and Max OSX

-dWindows for windows

-dLinux for Linux

Required Delphi switches: -DMSWINDOWS -$H+

For Delphi 5,6,7 use -DDelphi switch

For Delphi 2005,2006,2007,2009,2010+ use the switch -DDELPHI2005+

 

You can download my Synch module from:

http://pages.videotron.com/aminer/

 


Sincerely,
Amine Moulay Ramdane.

 

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9090
  • FPC developer.
Re: Synch module version 1.0 ...
« Reply #1 on: April 23, 2010, 09:28:32 am »
Linux and unix are already defined for Linux.

Moreover, your method for Linux is flawed, since it only works on linux/x86 (and not compile for anything else) It is doubly flawed because on linux it will include both the linux and the unix code.

Is this code tested at all?

P.s. Do NOT use unit libc for new development:

http://wiki.freepascal.org/libc_unit

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Synch module version 1.0 ...
« Reply #2 on: April 23, 2010, 08:15:41 pm »

Hello,

marcov wrote:
>Linux and unix are already defined for Linux.

>Moreover, your method for Linux is flawed, since it only works on >linux/x86 (and not compile for anything else) It is doubly flawed >because on linux it will include both the linux and the unix code.

>Is this code tested at all?

I don't have Linux or MacOSX here... please test itfor me.

If you delete {$ifdef Linux}{$endif}  parts  and use only
the {$ifdef Unix}{$endif} parts, does it work correctly ?


Sincerely,
Amine Moulay Ramdane.


aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Synch module version 1.0 ...
« Reply #3 on: April 23, 2010, 08:32:45 pm »


Hello,

I don't have Linux or MacOSX here... please test itfor me.


I have updated Synch to version 1.02:

http://pages.videotron.com/aminer/

I have tested it on Windows..

Please test it and tell me if it is working properly
on Mac OSX , Linux etc.



Amine.





marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9090
  • FPC developer.
Re: Synch module version 1.0 ...
« Reply #4 on: April 24, 2010, 10:43:53 am »
(all on FreeBSD/x86)

Free Pascal Compiler version 2.5.1 [2010/04/22] for i386
Copyright (c) 1993-2009 by Florian Klaempfl
Fatal: Can't find unit synch used by test
Fatal: Compilation aborted
Error: /home/marcov/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

This is due to writing Synch with capital "S", if I correct it, I get

Free Pascal Compiler version 2.5.1 [2010/04/22] for i386
Copyright (c) 1993-2009 by Florian Klaempfl
synch.pas(92,29) Error: Identifier not found "class"
synch.pas(92,40) Error: Error in type definition
synch.pas(93,25) Error: Identifier not found "class"
synch.pas(93,36) Error: Error in type definition
synch.pas(97,3) Error: Identifier not found "class"
synch.pas(97,3) Error: Error in type definition
synch.pas(97,3) Fatal: Syntax error, ";" expected but "identifier PRIVATE" found
Fatal: Compilation aborted
Error: /home/marcov/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

Apparantly FPC is not put into Delphi mode ({$mode delphi}), if I correct that it fails on "currenttm", windows unit and more:

Free Pascal Compiler version 2.5.1 [2010/04/22] for i386
Copyright (c) 1993-2009 by Florian Klaempfl
synch.pas(283,16) Error: Identifier not found "currenttm"
synch.pas(284,36) Error: Identifier not found "currenttm"
synch.pas(304,12) Error: Identifier not found "currenttm"
synch.pas(321,13) Error: Identifier not found "currenttm"
synch.pas(337,42) Error: Identifier not found "currenttm"
synch.pas(359,16) Error: Identifier not found "currenttm"
synch.pas(360,12) Error: Identifier not found "currenttm"
synch.pas(379,11) Error: Identifier not found "currenttm"
synch.pas(395,13) Error: Identifier not found "currenttm"
synch.pas(410,11) Error: Identifier not found "currenttm"
synch.pas(458,15) Error: Incompatible types: got "Pointer" expected "LongWord"
synch.pas(507,24) Error: Identifier not found "Windows"
synch.pas(586,15) Error: Incompatible types: got "Pointer" expected "LongWord"
synch.pas(681) Fatal: There were 13 errors compiling module, stopping
Fatal: Compilation aborted
Error: /home/marcov/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

The errors on 458 and 586 _might_ be related to several handle types on FreeBSD being pointer instead of  (unsigned/signed or long) integer types.
« Last Edit: April 24, 2010, 10:45:53 am by marcov »

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Synch module version 1.0 ...
« Reply #5 on: April 24, 2010, 03:26:51 pm »

Hello

Please download Synch version 1.03, and compile it again and
see if it is working properly:

http://pages.videotron.com/aminer/


Amine.


 

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Synch module version 1.0 ...
« Reply #6 on: April 24, 2010, 03:27:53 pm »

Hello,

And don't forget to use the delphi mode...


Amine.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2519
Re: Synch module version 1.0 ...
« Reply #7 on: April 24, 2010, 03:34:14 pm »
Hello,

And don't forget to use the delphi mode...

Amine.

IMO this should be part of the library and not of the commandline. each unit may be compiled with a a different mode.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Synch module version 1.0 ...
« Reply #8 on: April 24, 2010, 03:38:30 pm »

Hello

Yes, i will include it in the unit ...


Are you using Unix or Mac OSX , Marc ?

Can you download vesion 1.03 and compile and test
it for me ?



Amine.




marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9090
  • FPC developer.
Re: Synch module version 1.0 ...
« Reply #9 on: April 24, 2010, 09:52:34 pm »
1) filename is still uppercase
2) still need to set mode
3) line 368 has "ttm" instead of "tm".

If I fix that it compiles and appears to run on FreeBSD 8.0/x86

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Synch module version 1.0 ...
« Reply #10 on: April 25, 2010, 12:46:55 am »

Hello,

marcov i wrote:
>1) filename is still uppercase

I will change that.

>2) still need to set mode

I will correct it.

>3) line 368 has "ttm" instead of "tm".

I will correct  it.

>If I fix that it compiles and appears to run on FreeBSD 8.0/x86


Not too many problems - even if i don't have Unix here ! -

And i am happy that it works now for you :)



Amine.










aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Synch module version 1.0 ...
« Reply #11 on: April 25, 2010, 01:02:00 am »

Hello,

I have updated synch module to version 1.04...


http://pages.videotron.com/aminer/

Just to be sure that it is working properly, look inside
test.pas , if you set it like this:

Sem := TSemaphore.Create(1,1); // to 1,1

does the second 'sem.Acquire' enters in a 'wait' state ?



Amine.





aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Synch module version 1.0 ...
« Reply #12 on: April 25, 2010, 01:04:11 am »

>Hello,

>I have updated synch module to version 1.04...
>http://pages.videotron.com/aminer/

>Just to be sure that it is working properly, look inside
>test.pas , if you set it like this:
>Sem := TSemaphore.Create(1,1); // to 1,1

>does the second 'sem.Acquire' enters in a 'wait' state ?

>Amine.


Can someone else test the synch module on Mac OSX ?



Amine.





YarUnderoaker

  • New Member
  • *
  • Posts: 32
Re: Synch module version 1.0 ...
« Reply #13 on: October 05, 2010, 04:48:33 pm »
Hello.
There is progress?
Why Lazarus still has not cross-platform mutex and semaphore  ::) ?

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9090
  • FPC developer.
Re: Synch module version 1.0 ...
« Reply #14 on: October 06, 2010, 09:02:12 am »
Hello.
There is progress?
Why Lazarus still has not cross-platform mutex and semaphore  ::) ?

There are several synchronization classes in unit syncobjs.

 

TinyPortal © 2005-2018