Recent

Author Topic: Polling a semaphore  (Read 10004 times)

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Polling a semaphore
« Reply #15 on: October 09, 2017, 10:27:49 am »

Hmm ... shouldn't this generate an error / warning when compiling for Win32 target then:

Semaphore() functions are not available for the active target platform

??
No, see also answer from Florian in this bugreport. Basically when not needed they are allowed to be 'empty'.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Polling a semaphore
« Reply #16 on: October 09, 2017, 10:41:25 am »

Hmm ... shouldn't this generate an error / warning when compiling for Win32 target then:

Semaphore() functions are not available for the active target platform

??
No, see also answer from Florian in this bugreport. Basically when not needed they are allowed to be 'empty'.
yeah the burning question at this point is, not needed by what?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Polling a semaphore
« Reply #17 on: October 09, 2017, 10:43:21 am »
@taazz:
Unfortunately not many revealing threads on the subject, but 'what' seems to suggest (other) rtl (functionality).

PS: in case wondering, why not simply implement/add for windows, then this ML thread might perhaps be informative.
« Last Edit: October 09, 2017, 10:47:02 am by molly »

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Polling a semaphore
« Reply #18 on: October 09, 2017, 10:58:20 am »
@taazz:
Unfortunately not many revealing threads on the subject, but 'what' seems to suggest (other) rtl (functionality).

PS: in case wondering, why not simply implement/add for windows, then this ML thread might perhaps be informative.
It was most enlightening, thank you. At least now I can stop expecting a semaphore api any time soon. So perhaps I might enhance the posted class with a couple more methods and repost? I'll have to evaluate the time requirements later tonight.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Polling a semaphore
« Reply #19 on: October 09, 2017, 11:10:54 am »
It was most enlightening, thank you.
You're most welcome. It was just as enlightening for me as well :) Thank you for the trigger.

Quote
At least now I can stop expecting a semaphore api any time soon. So perhaps I might enhance the posted class with a couple more methods and repost? I'll have to evaluate the time requirements later tonight.
It seems that way, and yes i think that would be most welcome. I've seen some solutions being posted (too many links so got a bit lost, i probably stumbled on your suggestion/implementation as well).

WHen in dire need (and for windows only) one could perhaps have a look at this Delphi post as well.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Polling a semaphore
« Reply #20 on: October 09, 2017, 12:02:33 pm »
The current state of FPC (Default() etc) should warrant a more correct x-platform implementation. That was back 9 years ago....
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018