TMemIniFile是线程安全的吗? [英] Is TMemIniFile thread-safe?
问题描述
用户遇到间歇性错误无法创建文件 C:... \Filename.ini。无法在打开用户映射部分的文件上执行请求的操作。
A user is getting an intermittent error "Cannot create file "C:...\Filename.ini". The requested operation cannot be performed on a file with a user-mapped section open."
我无法找到有关此错误的很多信息,可以帮助您理解发生了什么。
I haven't been able to find much about this error that helps understand what's going on.
TMemIniFile线程安全吗?
Is TMemIniFile thread-safe?
推荐答案
据我所知TMemIniFile(以及任何其他TCustomIniFile后代)不是线程安全的。您需要将其包装到关键部分。
As far as I know TMemIniFile (and any other TCustomIniFile descendants) is not thread-safe. You will need to wrap it into a critical section.
在此链接,您可以找到线程安全的TCustomIniFile的实现(理论上由 TeamB ,尽管我不能保证)。
In this link you can find an implementation of a thread-safe TCustomIniFile (theoretically programmed by Peter Below of TeamB though I can not assure it).
Embarcadero论坛上还讨论了TMemIniFile的线程安全性此处。他们谈论组件的C ++版本。
There is also a discussion in the Embarcadero forums about the thread-safety of TMemIniFile here. They speak about the C++ version of the component.
您还可以在MSDN中找到有关错误消息来源的讨论此处。它有点长,但总体结论是有2个exe试图访问同一文件。您可以在此处找到其他讨论。
You can also find a discussion in MSDN regarding the origin of your error message here. It is a bit long but the general conclussion is that there are 2 exes trying to acces the same file. You can find another discussion on the subject here.
这篇关于TMemIniFile是线程安全的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!