#1 2017-03-17 17:06:41

Buckwheat
Member
Registered: 2017-03-17
Posts: 1

Calling function TSynBigTableString.Get() from multiple threads

I would like to create one TSynBigTableString object and call its function Get(const aID: RawUTF8; out aData: RawByteString): boolean from multiple threads simultaneously. Is it safe?

I, actually, did it. And in my tests function TSynBigTableString.Get() works fine for a while - returns proper values when called multiple times from multiple threads. But after a while it returns a garbage. I know that it returns a garbage because the values that I added to TSynBigTableString object are float values converted to strings (FloatToStr()). So, when function TSynBigTableString.Get() returns a garbage, function StrToFloat() raises an exception.

The solutions that I can see are:

1. Call function TSynBigTableString.Get() in a critical section.
2. Create separate TSynBigTableString object per thread.

Please let me know what you think. Thank you.

Offline

Board footer

Powered by FluxBB