Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-06

Platform independent alternatives

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

ZeelandNet Webmail Hi,

I'm porting an app from Delphi to Lazarus
when I came across a couple of functions from the windows unit. Can anyone help me finding the platform independent
alternatives?

TerminateThread
WaitForSingleObject
CloseHandle

TIA,
Darius

Reply by email

Flávio Etrusco
to Unknown author
Show quoted text 7 lines
Hi, I'm porting an app from Delphi to Lazarus when I came across a couple of functions from the windows unit. Can anyone help me finding the platform independent alternatives? TerminateThread

You shouldn't use it, generally speaking.

WaitForSingleObject

AFAICT there's no - there can't be ;-) - equivalent. What is the object you're waiting on?

CloseHandle TIA, Darius

What object are you closing?

-Flávio

Reply by email

Unknown author
to Flávio Etrusco
Flávio Etrusco wrote 12 lines
On Thu, Jun 23, 2011 at 3:18 PM, wrote: > Hi, > > I'm porting an app from Delphi to Lazarus when I came across a > couple of > functions from the windows unit. Can anyone help me finding the > platform > independent alternatives? > > TerminateThread You shouldn't use it, generally speaking.

You're right, I rewrote it so it doesn't use threads anymore. Thanks anyway.

Regards, Darius

Reply by email

leledumbo
to Unknown author: I'm porting an app from Delphi to Lazarus when I came across a couple of functions from…

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 .

Reply by email

Unknown author
to leledumbo

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 :

Show quoted text 12 lines
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 . _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Burkhard Carstens
to Unknown author

Am Freitag, 24. Juni 2011 19:55 schrieb

Show quoted text 27 lines
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.

This sounds very familiar.
.. the only thing I really miss is the WaitForMULTIPLEObjects ..

b.

Reply by email