[fpc-devel] Semaphore Support

Amir Amir at Aavani.net
Wed Dec 18 05:44:42 CET 2024


Hi,

   I had a wrapper around fpc's Semaphore (psem_t), and implemented a 
Blocking Stack on top of it. I see my code does not work correctly for 
the following use case:

I have defined a ThreadPool that each of its thread gets a data and may 
Push some  data into the stack while the main thread pop from the stack 
and invoke a call to ThreadPool.

  I have tested my ThreadPool and Semaphore Wrapper implementation 
before and they seem to work correctly.  But the above code does not 
work properly. When the main process get suspended, it does not get 
resumed.

The Wiki <https://wiki.freepascal.org/Threads#Semaphores> says "the 
semaphore implementation in FPC's RTL was Posix-only, and has been 
deprecated, and removed as of FPC 3.2.0". So is that the reason why my 
code is not working properly or the reason is that the main process 
cannot be resumed?

Best,
Amir

P.S. At this point, my project is too big to share here! I can make a 
sample project with a similar logic if that helps.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20241217/53bf7ad1/attachment.htm>


More information about the fpc-devel mailing list