Exemple #1
0
 public static void Read <T>(this ISynchronizableLock <T> sync, Action <T> read)
 {
     Read <T, Null>(sync, item =>
     {
         read(item);
         return(null);
     });
 }
Exemple #2
0
 public static void Write <T>(this ISynchronizableLock <T> sync, Action <T> write)
 {
     Write <T, Null>(sync, item =>
     {
         write(item);
         return(null);
     });
 }
        public Synchronizable(T instance)
        {
#if XAMARIN
            // RWLockSlim on mono (3.2 as of writing) seems to be time consuming, particularly when performing unusually long SpinLocks.
            // Until this is resolved, revert to standard locking.
            syncLock = new SynchronizableExclusiveLock <T>(instance);
#else
        #if WINDOWS_PHONE
            if (UseExclusiveLock)
            {
                syncLock = new SynchronizableExclusiveLock <T>(instance);
            }
            else
        #endif
            {
                syncLock = new SynchronizableLock <T>(instance);
            }
#endif // XAMARIN
        }
Exemple #4
0
 public static IDisposable CreateReleaseScope <T>(this ISynchronizableLock <T> sync)
 {
     return(sync.CreateReleaseScope(-1));
 }
Exemple #5
0
 public static bool Write <T>(this ISynchronizableLock <T> sync, Func <T, bool> read, Action <T> write)
 {
     return(sync.Write(-1, read, write));
 }
Exemple #6
0
 public static TValue Read <T, TValue>(this ISynchronizableLock <T> sync, Func <T, TValue> read)
 {
     return(sync.Read(-1, read));
 }
Exemple #7
0
 public static TValue Write <T, TValue>(this ISynchronizableLock <T> sync, Func <T, TValue> write)
 {
     return(sync.Write(-1, write));
 }
Exemple #8
0
 public Synchronizable(T instance)
 {
     syncLock = new SynchronizableLock <T>(instance);
 }