You are not logged in.
Pages: 1
Hi,
TSynQueue.Count method uses ReadOnlyLock, and it makes problems when the Queue is shared between threads that are using the count while others are reading from or writing into it.
It was a weird error to find but in some cases it trough exceptions and maybe it is a good idea to use ReadWriteLock instead in Count. In my case it solved the issue like this:
with Queue do
try
Safe.ReadWriteLock;
QueueCount := Queue.Count;
finally
Safe.ReadWriteUnLock;
end;
Offline
I guess Count is of little help in practice. The useful property is Pending.
I have fixed TSynQueue.Count usage with
See https://github.com/synopse/mORMot2/commit/bcc9b351
Offline
Thank you!
Offline
Pages: 1