[fpc-pascal] semaphores?

Michael Van Canneyt michael at freepascal.org
Mon Apr 20 11:14:47 CEST 2009



On Mon, 20 Apr 2009, Jonas Maebe wrote:

> 
> On 20 Apr 2009, at 10:30, Michael Van Canneyt wrote:
> 
> >On Mon, 20 Apr 2009, Jonas Maebe wrote:
> >
> > >On 14 Apr 2009, at 13:42, Michael Van Canneyt wrote:
> > >
> > > >Use GetThreadManager() to retrieve the thread manager, and then
> > > >simply use the various functions.
> > >
> > >No, the thread manager is only for internal use by the RTL, and may lack
> > >implementations for functions not required by the RTL for a particular
> > >platform. See http://bugs.freepascal.org/view.php?id=11206
> >
> >That was definitely not the original intention of the thread manager.
> >
> >The idea was to have low-level thread related functions available without
> >classes, including semaphores.
> 
> I don't think the thread manager is an appropriate model for this, as it may
> have to be changed depending on internal requirements of the RTL (for example,
> a big shortcoming currently is that the thread manager generally lacks error
> reporting functionality, other than triggering run time errors). An
> abstraction layer on top of the thread manager seems more appropriate for the
> purpose of offering a portable procedural threading interface.

That was exactly the intention. Prior to giving my answer, I checked and
discovered that the semaphor low-level functions do not exist, so I
recommended to use the thread manager record. While checking, I also
saw that there is no implementation for windows.

> 
> It's similar to how you don't directly use the memory manager, but instead
> have to use getmem/freemem/...

Agreed 100%, but I was trying to present a workaround.

Michael.



More information about the fpc-pascal mailing list