VirtualBox

Changeset 8020 in vbox for trunk/include


Ignore:
Timestamp:
Apr 16, 2008 10:14:39 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
29679
Message:

Main/Settigs: Disabled File (..., RTFILE aHandle, ...) constructor since it is not thread-safe when the handle is shared across different File instances (needs a handle duplicate operation in the IPRT File API).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/settings.h

    r7388 r8020  
    8181 * Making deep copies or detaching the existing shallow copy from its original
    8282 * is not yet supported.
     83 *
     84 * Note that the Settings File API is not thread-safe. It means that if you
     85 * want to use the same instance of a class from the settings namespace on more
     86 * than one thread at a time, you will have to provide necessary access
     87 * serialization yourself.
    8388 *
    8489 * Due to some (not propely studied) libxml2 limitations, the Settings File
     
    11711176 * regular files.
    11721177 *
    1173  * The File class uses IPRT File API for file operations.
     1178 * The File class uses IPRT File API for file operations. Note that IPRT File
     1179 * API is not thread-safe. This means that if you pass the same RTFILE handle to
     1180 * different File instances that may be simultaneously used on different
     1181 * threads, you should care about serialization; otherwise you will get garbage
     1182 * when reading from such File instances.
     1183 *
     1184 * @todo We should duplicate file handles (once this API is in IPRT) passed to
     1185 *       constructors to provide thread-safety.
    11741186 */
    11751187class VBOXSETTINGS_CLASS File : public Input, public Output
     
    11921204    File (Mode aMode, const char *aFileName);
    11931205
     1206#if 0
     1207    /// @todo disabled until made thread-safe by using handle duplicates
    11941208    /**
    11951209     * Uses the given file handle to perform file operations. The given file
     
    12041218     * this object destruction.
    12051219     *
     1220     * @note It you pass the same RTFILE handle to more than one File instance,
     1221     *       please make sure you have provided serialization in case if these
     1222     *       instasnces are to be simultaneously used by different threads.
     1223     *       Otherwise you may get garbage when reading or writing.
     1224     *
    12061225     * @param aHandle   Open file handle.
    12071226     * @param aMode     File mode of the open file handle.
    1208      * @param aFileName File name (for reference).
    1209      */
    1210     File (Mode aMode, RTFILE aHandle, const char *aFileName = NULL);
     1227     * @param aFileName File name (for reference, may be NULL).
     1228     */
     1229    File (Mode aMode, RTFILE aHandle, const char *aFileName);
     1230#endif
    12111231
    12121232    /**
     
    12821302/**
    12831303 * The XmlTreeBackend class uses XML markup to store settings trees.
     1304 *
     1305 * @note libxml2 and libxslt libraries used by the XmlTreeBackend are not
     1306 * fully reentrant. To "fix" this, the XmlTreeBackend backend serializes access
     1307 * to such non-reentrant parts using a global mutex so that only one thread can
     1308 * use non-reentrant code at a time. Currently, this relates to the #rawRead()
     1309 * method (and to #read() as a consequence). This menas that only one thread can
     1310 * parse an XML stream at a time; other threads trying to parse same or
     1311 * different streams using different XmlTreeBackend and Input instances
     1312 * will have to wait.
     1313 *
     1314 * Keep in mind that the above reentrancy fix does not imply thread-safety: it
     1315 * is still the caller's responsibility to provide serialization if the same
     1316 * XmlTreeBackend instnace (as well as instances of other classes from the
     1317 * settings namespace) needs to be used by more than one thread.
    12841318 */
    12851319class VBOXSETTINGS_CLASS XmlTreeBackend : public TreeBackend
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette