Current News
Archived News
Search News
Discussion Forum


Old Forum
Install Programs More Downloads...
Troubleshooting
Source Code
Format Specs.
Misc. Information
Non-SF Stuff
Links




CommitLineData
7df24e1f 1====================================
2SFmpq in multi-threaded applications
3====================================
4
5A note about archive and file handles: In most cases, archive and file handles should not be shared between threads. Instead, open a new handle for each thread that will be reading from or writing to the archive or file. However, if no threads have direct access to the handle and only one is able to use the archive or file at a time, sharing handles can be done. Also, archive handles may be shared between threads when you are only reading files from the archive.
6
7-------------------------------
8Always nonthread-safe functions
9-------------------------------
10SFileOpenFileAsArchive
11SFileOpenArchive
12SFileCloseArchive
13SFileOpenFile
14SFileOpenFileEx
15SFileCloseFile
16SFileSetLocale (same value is used for all threads, so changing it for one changes it for all)
17SFileSetBasePath (should not be called at same time as itself or SFileGetBasePath, same value is used for all threads)
18SFileSetArchivePriority
19MpqOpenArchiveForUpdate
20MpqCloseUpdatedArchive
21MpqAddFileToArchiveEx
22MpqAddFileToArchive
23MpqAddWaveToArchive
24MpqAddFileFromBufferEx
25MpqAddFileFromBuffer
26MpqAddWaveFromBuffer
27MpqRenameFile
28MpqRenameAndSetFileLocale
29MpqDeleteFile
30MpqDeleteFileWithLocale
31MpqCompactArchive
32MpqSetFileLocale
33
34-----------------------------------
35Conditionally thread-safe functions
36-----------------------------------
37
38Note: All file reading functions are thread-safe if separate handles are used for each thread and no functions are being used that would change the archive or files in any way. If an archive is opened with write access, no other thread should be able to open another handle to it.
39
40Should not be called while opening or closing archives or files
41---------------------------------------------------------------
42SFileGetArchiveName
43SFileGetFileName
44SFileGetFileInfo
45
46Should not be called if the archive or file handle being used will be closed
47----------------------------------------------------------------------------
48SFileGetFileSize
49SFileGetFileArchive
50SFileSetFilePointer
51SFileReadFile
52SFileListFiles
53SFileFindMpqHeader
54
55Other conditions
56----------------
57SFileGetBasePath (should not be called at same time as SFileSetBasePath)
58
59----------------------------
60Always thread-safe functions
61----------------------------
62SFileDestroy
63StormDestroy
64SFMpqDestroy
65MpqInitialize
66MpqGetVersionString
67MpqGetVersion
68SFMpqGetVersionString
69SFMpqGetVersionString2
70SFMpqGetVersion
71AboutSFMpq
72SFMpqCompareVersion
73