[fpc-pascal] Semaphore problems
Vinzent Hoefler
JeLlyFish.software at gmx.net
Tue Jul 25 17:10:25 CEST 2006
On Tuesday 25 July 2006 14:51, Micha Nelissen wrote:
> Vinzent Hoefler wrote:
> > Ok, there's a glitch: The read and write of self.ThreadId is
> > required to be atomic, so that a thread entering may either see "0"
> > or the owner's thread id when checking, otherwise it could be
> > possible, it sees its own thread_id due to a partial update and
> > *then* it goes really wrong.
>
> It's not a glitch but an assumption I'd say.
Well, it will become a glitch, if the assumption about the atomic read/
write turns out to be wrong. ;-)
> The compiler devels should be able to answer whether we can assume
> this, or not ?
Well, I suppose so. But in the end it depends on the target
architecture, not the compiler in general.
That's BTW, one of the reasons I'd like to have a Pascal's equivalent of
Ada's "Pragma Atomic(...)" and "Pragma Volatile(...)" for certain types
and variables.
Vinzent.
More information about the fpc-pascal
mailing list