Esempio n. 1
0
 private void saveThreadFunc()
 {
     Thread.Sleep(2000);
     lock (_lock)
     {
         SettingsUtil.save(_saveObj, _saveFilename, _saveSerializer, SettingsOnFailure.DoNothing);
         _saveThread = null;
     }
 }
Esempio n. 2
0
 /// <summary>
 ///     <para>
 ///         Saves the settings.</para>
 ///     <para>
 ///         This method is fully compatible with <see cref="SettingsThreadedBase.SaveThreaded"/>, and will cancel any
 ///         pending earlier (older) saves.</para></summary>
 public virtual void Save(string filename = null, SettingsSerializer?serializer = null, SettingsOnFailure onFailure = SettingsOnFailure.Throw)
 {
     // Save and delete must not be interrupted or superseded by a SaveThreaded
     lock (_lock)
     {
         if (_saveThread != null) // this can only ever occur in the Sleep/lock wait phase of the quick save thread
         {
             _saveThread.Abort();
             _saveThread = null;
         }
         SettingsUtil.save(this, filename, serializer, onFailure);
     }
 }