[fpc-pascal] Re: Platform independent alternatives

fluisgirardi at gmail.com fluisgirardi at gmail.com
Fri Jun 24 19:55:40 CEST 2011


Some years ago, I started the port of my project (PascalSCADA) from
Windows to others platforms. I found some issues doing this. I used
all resources that the FPC RTL can offer.

To thread, I used TThread class. The issues that I found porting this,
is that Suspend/Resume don't works on others platforms than Windows.
So I rewrite my code to don't use this.

Windows messages was replaced by a class that I created to exchange
messages between threads, not process.

TCriticalSection worked as expected on all platforms, except because
it isn't a recursive mutex on unix, like it's on Windows. Again, a
little code change to avoid problems.

TEvent works as expected on all platforms since FPC 2.4.x. How it was
fixed only on FPC 2.4 version AND I want support FPC 2.2.x series, I
created my own class of Event, based on changes of TEvent class of
FPC.

Now my project works fine at least on Windows, Linux and FreeBSD,
using the thread support of FreePascal.

I avoided to use advanced resources of threading of each OS to keep my
project more platform independently as possible. Functions as
WaitForSingleObject I'm avoiding to use.


The best regards,

Fabio


2011/6/24 leledumbo <leledumbo_cool at yahoo.co.id>:
> Rewrite the threading code with FPC one (i.e. BeginThread - EndThread, or the
> more beautiful TThread). WaitForSingleObject... I've never used this,
> perhaps SyncObjs and its critical section handler? CloseHandle: depending on
> how you open it, close with its correct pair.
>
> --
> View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Platform-independent-alternatives-tp4518482p4521676.html
> Sent from the Free Pascal - General mailing list archive at Nabble.com.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



More information about the fpc-pascal mailing list