Re: [fpc-pascal] Semaphores removed from the rtl?

2017-07-22 Thread Anthony Walter
Michael, no I don't. I use
https://github.com/sysrpl/Bare.Game/blob/master/source/bare.interop.sdl2.pas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Semaphores removed from the rtl?

2017-07-22 Thread Michael Schnell



On 19.07.2017 18:29, Anthony Walter wrote:


As a note to this, I am using semaphores quite a bit in SDL2 ...

Do you use Jedi-SDL to combine fpc and SDL ?

-Michael
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Semaphores removed from the rtl?

2017-07-19 Thread Sven Barth via fpc-pascal
Am 19.07.2017 18:45 schrieb "Anthony Walter" :
>
> Nah thanks, I can implement them with native functions on windows, mac,
and linux easily enough and with $ifdefs. I am just surprised by the
thought process involved in removing them.

As Charlie said, that functionality was never intended for public use and
only available for a specific use case.

For cross platform use the Delphi compatible TSemaphore in the SyncObjs
unit should be implemented...

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Semaphores removed from the rtl?

2017-07-19 Thread Karoly Balogh (Charlie/SGR)
Hi,

On Wed, 19 Jul 2017, Anthony Walter wrote:

> Thanks for that bit of information Charlie. I should have searched the
> svn logs.
>
> (...)
>
> It just seems to me like the concept of a semaphore has been well
> established in CS for decades and it's a bit weird to remove them from
> the rtl. They are native to all platforms (I just checked). Sure they we
> not used by any rtl internal functions/objects (in TThread for example),
> but I don't believe that should have been reason enough to get rid of
> them.

They weren't implemented for all platforms in our RTL. Among others, using
FPC's Semaphore functions on Windows were resulting in no-ops or Runtime
errors (probably the later, I don't have Windows at hand to verify). This
is what I mean. I'm not saying they were impossible to implement, just
that they never were implemented in FPC RTL, for any platforms except
Unices. And they were never intended to appear in the System unit public
interface either. (Sadly they have, but that's a different story.)

> In other words, just because a one group of developers don't use a tool,
> that shouldn't dictate its removal.

In this case, those tools were incomplete and unfinished. But I am not
arguing against Semaphores as a concept. You are free to implement
Semaphore-alike behavior using CriticalSections for example, which are
implemented on all platforms which support Threading in the FPC RTL.

Charlie___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Semaphores removed from the rtl?

2017-07-19 Thread Anthony Walter
Nah thanks, I can implement them with native functions on windows, mac, and
linux easily enough and with $ifdefs. I am just surprised by the thought
process involved in removing them.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Semaphores removed from the rtl?

2017-07-19 Thread Benjamin Rosseaux
You could use TPasMPSemaphore from my PasMP project (
https://github.com/BeRo1985/pasmp/ and respectively
https://github.com/BeRo1985/pasmp/blob/master/src/PasMP.pas ) which is also
cross-platform-capable.

On Wed, Jul 19, 2017 at 6:29 PM, Anthony Walter  wrote:

> Thanks for that bit of information Charlie. I should have searched the svn
> logs.
>
> As a note to this, I am using semaphores quite a bit in SDL2 to guard
> against things like changes to audio banks in the ui thread and reading
> audio sample bits in the audio mixer thread, which SDL2 sets up whenever
> you play audio. There are other places where I use semaphores, but the
> point is SDL2 implements semaphores across all platforms and they work
> consistently.
>
> https://wiki.libsdl.org/SDL_CreateSemaphore
>
> It just seems to me like the concept of a semaphore has been well
> established in CS for decades and it's a bit weird to remove them from the
> rtl. They are native to all platforms (I just checked). Sure they we not
> used by any rtl internal functions/objects (in TThread for example), but I
> don't believe that should have been reason enough to get rid of them.
>
> In other words, just because a one group of developers don't use a tool,
> that shouldn't dictate its removal.
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Semaphores removed from the rtl?

2017-07-19 Thread Anthony Walter
Thanks for that bit of information Charlie. I should have searched the svn
logs.

As a note to this, I am using semaphores quite a bit in SDL2 to guard
against things like changes to audio banks in the ui thread and reading
audio sample bits in the audio mixer thread, which SDL2 sets up whenever
you play audio. There are other places where I use semaphores, but the
point is SDL2 implements semaphores across all platforms and they work
consistently.

https://wiki.libsdl.org/SDL_CreateSemaphore

It just seems to me like the concept of a semaphore has been well
established in CS for decades and it's a bit weird to remove them from the
rtl. They are native to all platforms (I just checked). Sure they we not
used by any rtl internal functions/objects (in TThread for example), but I
don't believe that should have been reason enough to get rid of them.

In other words, just because a one group of developers don't use a tool,
that shouldn't dictate its removal.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Semaphores removed from the rtl?

2017-07-19 Thread Karoly Balogh (Charlie/SGR)
Hi,

On Wed, 19 Jul 2017, Anthony Walter wrote:

> When and why were semaphores removed from the rtl?

They are removed from trunk since Sept 2016, and I think they were
deprecated for a while now, although I cannot confirm this. But what's
sure, they were only implemented and used interally for Unix. Affected
revisions:

https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision=28965
https://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision=34542

The commit messages should explain the whys, I think.

Although the code still has some leftovers here and there, and what's
sure, they weren't deprecated with a warning period :(, although I'm not
sure they were ever intended for public use... The documentation knows
about them at least, and they were public since 2014, but I think even
back then this was debated.

Charlie
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal