Commit Graph
26 Commits
Author SHA1 Message Date
Jérémie Laval 87f072d29c Remove CurrentLockState in ReaderWriterLockSlim and reuse ThreadLockState instance more often. 2010-11-09 14:57:14 +00:00
Jérémie Laval 5f71cbd7d6 Small condition fix in ReaderWriterLockSlim, avoid an extra loop pass. 2010-11-09 14:57:14 +00:00
Jérémie Laval 63ebd7b9d6 ReaderWriterLockSlim performance improvements 2010-11-04 15:51:33 +00:00
Jérémie Laval 0932636327 Add tiny bit of doc on ReaderWriterLockSlim. 2010-11-03 20:14:06 +00:00
Jérémie Laval 8e3bbe1893 [ReaderWriterLockSlim] Fix state corruption and race in a special interleaving.
Fix possible state corruption in the case where Upgradeable wasn't reactivating its read bit after a downgrade and set events accordingly. Fix possible race where a write process wannabe could step in the middle of Upgradeable actually upgrading to write mode.
2010-09-29 14:52:20 +01:00
Jérémie Laval e0d372e7bf Turn Is*LockHeld properties into thread-specific values in ReaderWriterLockSlim. Add corresponding unit tests. 2010-09-28 13:23:05 +01:00
Jérémie Laval 4b844f8105 Add tidbits of documentation to ReaderWriterLockSlim. 2010-09-22 11:33:55 +01:00
Jérémie Laval 65180d590b Also set readerDoneEvent when exiting an upgradeable lock and reader condition is correct.
It could cause a deadlock when a writer tested the rwlock value before RwRead was removed and another Upgradeable operation happened at the same time.
2010-09-22 11:04:03 +01:00
Jérémie Laval 5c52755ffd Allow recursive Write + n * Read lock pattern for ReaderWriterLockSlim and add corresponding unit test 2010-09-01 14:26:42 +01:00
Jérémie Laval c70d5fff59 Generalize ThreadLockState to include recursive count informations and update them accordingly in the different Enter/Exit methods 2010-09-01 13:56:11 +01:00
Jérémie Laval ac4bd81b23 Change the key of the inner dictionary to an int id instead of the instance itself
It prevents object references to the rwlslim to be kept and thus not GC'ed
2010-09-01 11:10:09 +01:00
Jérémie Laval 3f65781d83 Split ReaderWriterLockSlim helper classes into their own files 2010-09-01 11:10:09 +01:00
Jérémie Laval cf6cb84548 Fix non 4.0 build of ReaderWriterLockSlim.
It needs to be cleaned up though.
2010-08-31 17:51:35 +01:00
Jérémie Laval f77f094d46 Enable basic recursion support in ReaderWriterLockSlim. Works when reacquiring lock of the same type. 2010-08-31 17:01:39 +01:00
Jérémie Laval a13cb7d229 Use ManualResetEventSlim instances to wait for lock changes instead of hardcoded Thread.Sleep calls in ReaderWriterLockSlim. 2010-08-31 17:01:39 +01:00
Jérémie Laval f706ec1dd4 Remove unused bit position constants in ReaderWriterLockSlim 2010-08-31 17:01:39 +01:00
Jérémie Laval dbf53c74c4 Finish reimplementation of ReaderWriterLockSlim so that it pass unit tests. 2010-08-31 17:01:36 +01:00
Jérémie Laval 8297cbde16 Refactor ThreadLockState acquisition into a real per-thread, per-rwlock-instance value 2010-08-31 17:01:35 +01:00
Jérémie Laval 16e2f091f0 Rework ReaderWriterLockSlim to use simpler Interlocked arithmetic. 2010-08-31 17:01:35 +01:00
Marek Safar 6d2dd00b2a More 4.0 bootstrap work
svn path=/trunk/mcs/; revision=141787
2009-09-11 20:08:44 +00:00
Atsushi Eno 440ba3208d 2009-06-15 Atsushi Enomoto <[email protected]>
* ReaderWriterLockSlim.cs : fix deadlock when entered
          read lock -> entered writer lock -> exited writer lock
          -> exited read lock and then entered reader lock.
          Fixed bug #512485, patch by Kazuki Oikawa.

        * ReaderWriterLockSlimTest.cs : test for bug #512485, by
          Kazuki Oikawa.


svn path=/trunk/mcs/; revision=136109
2009-06-15 10:27:41 +00:00
Marek Safar fe33ddf900 2009-06-10 Marek Safar <[email protected]>
* LockRecursionException.cs: Updated to 4.0 changes.


svn path=/trunk/mcs/; revision=135853
2009-06-10 14:25:02 +00:00
Marek Safar 2101a3d1e7 2009-01-18 Marek Safar <[email protected]>
* ReaderWriterLockSlim.cs: Implemented all properties.


svn path=/trunk/mcs/; revision=123729
2009-01-18 13:24:26 +00:00
Marek Safar f1f810e35b 2008-12-02 Marek Safar <[email protected]>
* ReaderWriterLockSlim.cs: Initial merge.


svn path=/trunk/mcs/; revision=120496
2008-12-02 16:25:32 +00:00
Miguel de Icaza 6970bc3360 Add initial implementation of ReaderWriterLockSlim, it is missing support for recursive locks, and support for flagging errors
svn path=/trunk/mcs/; revision=120435
2008-12-02 00:55:07 +00:00
Marek Safar 0a9078b0d9 2008-09-05 Marek Safar <[email protected]>
* System.Core.dll.sources: Add System.Threading


svn path=/trunk/mcs/; revision=112366
2008-09-05 09:12:35 +00:00