Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-02

TMultiReadExclusiveWriteSynchronizer

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

David Jenkins

Under Delphi if the TMultiReadExclusiveWriteSynchronizer writelock is held a read is not blocked if the ThreadID for the read is the same as the ThreadID for the write. Under FreePascal if writelock is held the read is always blocked regardless of ThreadID or anything else (implemented in the BeginRead method).

I have some third party code that assumes that
TMultiReadExclusiveWriteSynchronizer will work as it does in Delphi. I am wondering if the freepascal implementation is purposeful (read block even when in same thread is intentional) and I should talk to my third party vendor. Or if this is something that could/should be addressed in FreePascal.

Thanks

David Jenkins
Scooter Software

Reply by email

Jonas Maebe
to David Jenkins
David Jenkins wrote 12 lines
Under Delphi if the TMultiReadExclusiveWriteSynchronizer writelock is held a read is not blocked if the ThreadID for the read is the same as the ThreadID for the write. Under FreePascal if writelock is held the read is always blocked regardless of ThreadID or anything else (implemented in the BeginRead method). I have some third party code that assumes that TMultiReadExclusiveWriteSynchronizer will work as it does in Delphi. I am wondering if the freepascal implementation is purposeful (read block even when in same thread is intentional) and I should talk to my third party vendor. Or if this is something that could/should be addressed in FreePascal.

http://edn.embarcadero.com/article/28258 indicates that promoting read locks to write locks should work by design (which the current FPC implementation doesn't support either), so it's logical to assume that acquiring a read lock while you hold a write lock should also be possible. Feel free to file a bug report.

Jonas

Reply by email