An alternative to UBB.threads
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FLocal/Core/DB/ITransaction.cs

42 lines
668 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FLocal.Core.DB {
abstract class Transaction : IDisposable {
abstract protected void do_Commit();
abstract protected void do_Rollback();
private bool finalized = false;
public void Commit() {
lock(this) {
this.do_Commit();
this.finalized = true;
}
}
public void Rollback() {
lock(this) {
this.do_Rollback();
this.finalized = true;
}
}
public void Dispose() {
lock(this) {
if(!this.finalized) {
this.do_Rollback();
this.finalized = true;
}
}
}
}
}