Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-07 Thread Mark Morgan Lloyd
Jonas Maebe wrote: On 07 Oct 2013, at 11:33, Marco van de Voort wrote: In our previous episode, Jonas Maebe said: [interlocked increment/decrement] They do not include any memory barrier. The only thing those routines guarantee on all platforms, is that the value is atomically incremented/dec

Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-07 Thread Jonas Maebe
On 07 Oct 2013, at 11:33, Marco van de Voort wrote: In our previous episode, Jonas Maebe said: [interlocked increment/decrement] They do not include any memory barrier. The only thing those routines guarantee on all platforms, is that the value is atomically incremented/decremented. (btw th

Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-07 Thread Mark Morgan Lloyd
Jonas Maebe wrote: On 07 Oct 2013, at 09:14, Mark Morgan Lloyd wrote: Benito van der Zander wrote: In the end I stuck in code to increment/decrement a counter, and looked for it to be explicitly 0 or 1. Do you need to put a memory barrier around that, or does the critical section take care

Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-07 Thread Marco van de Voort
In our previous episode, Jonas Maebe said: > > I used the interlocked increment/decrement, which- as I understand > > it- should handle membar itself on architectures that can benefit > > from it. > > They do not include any memory barrier. The only thing those routines > guarantee on all pl

Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-07 Thread Jonas Maebe
On 07 Oct 2013, at 09:14, Mark Morgan Lloyd wrote: Benito van der Zander wrote: In the end I stuck in code to increment/decrement a counter, and looked for it to be explicitly 0 or 1. Do you need to put a memory barrier around that, or does the critical section take care of that? I used

Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-07 Thread Mark Morgan Lloyd
Benito van der Zander wrote: In the end I stuck in code to increment/decrement a counter, and looked for it to be explicitly 0 or 1. Do you need to put a memory barrier around that, or does the critical section take care of that? I used the interlocked increment/decrement, which- as I unde

Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-06 Thread Benito van der Zander
In the end I stuck in code to increment/decrement a counter, and looked for it to be explicitly 0 or 1. Do you need to put a memory barrier around that, or does the critical section take care of that? On 10/06/2013 06:55 PM, Mark Morgan Lloyd wrote: Michael Van Canneyt wrote: On Sun, 6

Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-06 Thread Michael Van Canneyt
On Sun, 6 Oct 2013, Mark Morgan Lloyd wrote: Michael Van Canneyt wrote: On Sun, 6 Oct 2013, Mark Morgan Lloyd wrote: Is there a preferred way of reading back whether something (including the current thread) has already entered a TCriticalSection? To my knowlede this does not exist. The M

Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-06 Thread Mark Morgan Lloyd
Michael Van Canneyt wrote: On Sun, 6 Oct 2013, Mark Morgan Lloyd wrote: Is there a preferred way of reading back whether something (including the current thread) has already entered a TCriticalSection? To my knowlede this does not exist. The Microsoft implementation of a critical section has

Re: [fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-06 Thread Michael Van Canneyt
On Sun, 6 Oct 2013, Mark Morgan Lloyd wrote: Is there a preferred way of reading back whether something (including the current thread) has already entered a TCriticalSection? To my knowlede this does not exist. The Microsoft implementation of a critical section has TryEnterCriticalSection,

[fpc-pascal] Getting the state of a TRTLCriticalSection

2013-10-06 Thread Mark Morgan Lloyd
Is there a preferred way of reading back whether something (including the current thread) has already entered a TCriticalSection? I'm trying to put assertions in code that, partly under non-GUI thread control via Synchronize, adds and deletes pages to a TPageControl. If I do this property Bl