[fpc-pascal] semaphores?

Michael Van Canneyt michael at freepascal.org
Tue Apr 14 13:42:21 CEST 2009



On Tue, 14 Apr 2009, Graeme Geldenhuys wrote:

> On Mon, Apr 13, 2009 at 11:49 PM, Seth Grover <sethdgrover at gmail.com> wrote:
> > Is there not a cross-platform semaphore API in Free Pascal? I planned
> 
> About 4 years ago there wasn't, so I had to use IFDEF's in my code. I
> haven't looked in newer versions of FPC if there is a cross-platform
> API available. I would be interested in this as well.

Well:

  TThreadManager = Record
   // skip some stuff
    SemaphoreInit          : TSempahoreInitHandler;
    SemaphoreDestroy       : TSemaphoreDestroyHandler;
    SemaphorePost          : TSemaphorePostHandler;
    SemaphoreWait          : TSemaphoreWaitHandler;
  end;

Use GetThreadManager() to retrieve the thread manager, and then
simply use the various functions.

This should work cross-platform, but it seems that the Windows 
implementation is empty. Maybe we can use your functions to
implement the windows part.

Michael.



More information about the fpc-pascal mailing list