@@ -39,7 +39,12 @@ namespace SevenZip
3939 /// 7-zip library low-level wrapper.
4040 /// </summary>
4141 internal static class SevenZipLibraryManager
42- {
42+ {
43+ /// <summary>
44+ /// Synchronization root for all locking.
45+ /// </summary>
46+ private static readonly object _syncRoot = new object ( ) ;
47+
4348#if ! WINCE && ! MONO
4449 /// <summary>
4550 /// Path to the 7-zip dll.
@@ -120,7 +125,7 @@ private static void Init()
120125 /// <param name="format">Archive format</param>
121126 public static void LoadLibrary ( object user , Enum format )
122127 {
123- lock ( _libraryFileName )
128+ lock ( _syncRoot )
124129 {
125130 if ( _inArchives == null
126131#if COMPRESS
@@ -164,7 +169,6 @@ public static void LoadLibrary(object user, Enum format)
164169 "Enum " + format + " is not a valid archive format attribute!" ) ;
165170 }
166171 }
167- }
168172
169173 /*/// <summary>
170174 /// Gets the native 7zip library version string.
@@ -192,7 +196,7 @@ public static bool ModifyCapable
192196 {
193197 get
194198 {
195- lock ( _libraryFileName )
199+ lock ( _syncRoot )
196200 {
197201 if ( ! _modifyCapabale . HasValue )
198202 {
@@ -256,7 +260,7 @@ public static LibraryFeature CurrentLibraryFeatures
256260 {
257261 get
258262 {
259- lock ( _libraryFileName )
263+ lock ( _syncRoot )
260264 {
261265 if ( _features != null && _features . HasValue )
262266 {
@@ -360,7 +364,7 @@ public static void FreeLibrary(object user, Enum format)
360364 var sp = new SecurityPermission ( SecurityPermissionFlag . UnmanagedCode ) ;
361365 sp . Demand ( ) ;
362366#endif
363- lock ( _libraryFileName )
367+ lock ( _syncRoot )
364368 {
365369 if ( _modulePtr != IntPtr . Zero )
366370 {
@@ -434,7 +438,7 @@ public static void FreeLibrary(object user, Enum format)
434438 /// <param name="user">Archive format user.</param>
435439 public static IInArchive InArchive ( InArchiveFormat format , object user )
436440 {
437- lock ( _libraryFileName )
441+ lock ( _syncRoot )
438442 {
439443 if ( _inArchives [ user ] [ format ] == null )
440444 {
@@ -498,7 +502,7 @@ public static IInArchive InArchive(InArchiveFormat format, object user)
498502 /// <param name="user">Archive format user.</param>
499503 public static IOutArchive OutArchive ( OutArchiveFormat format , object user )
500504 {
501- lock ( _libraryFileName )
505+ lock ( _syncRoot )
502506 {
503507 if ( _outArchives [ user ] [ format ] == null )
504508 {
0 commit comments