[geary/mjog/mutex-lock-cleanup: 3/3] engine: Minor database locking cleanup
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/mutex-lock-cleanup: 3/3] engine: Minor database locking cleanup
- Date: Sun, 4 Apr 2021 04:03:21 +0000 (UTC)
commit 72285c454aafaa8cee98465b89fa2be2117f44d5
Author: Michael Gratton <mike vee net>
Date: Sun Apr 4 14:01:23 2021 +1000
engine: Minor database locking cleanup
Remove some unused/uneeded code protected by locks in
`Geary.Db.Database`.
src/engine/db/db-database.vala | 47 ++++++++++++------------------------------
1 file changed, 13 insertions(+), 34 deletions(-)
---
diff --git a/src/engine/db/db-database.vala b/src/engine/db/db-database.vala
index b09e6eb33..a0e45eb26 100644
--- a/src/engine/db/db-database.vala
+++ b/src/engine/db/db-database.vala
@@ -31,6 +31,18 @@ public class Geary.Db.Database : Context {
*/
public File? file { get; private set; }
+ /** Indicates whether the database has been opened. */
+ public bool is_open { get; private set; }
+
+ /** The set of flags the database was opened with, if any. */
+ public DatabaseFlags flags { get; private set; }
+
+ /** {@inheritDoc} */
+ public override Logging.Source? logging_parent {
+ get { return _logging_parent; }
+ }
+ private weak Logging.Source? _logging_parent = null;
+
/**
* The path passed to Sqlite when constructing the database.
*
@@ -38,31 +50,9 @@ public class Geary.Db.Database : Context {
* persistent databases, else {@link MEMORY_PATH} for transient
* databases.
*/
- public string path { get; private set; }
-
- public DatabaseFlags flags { get; private set; }
-
- private bool _is_open = false;
- public bool is_open {
- get {
- lock (_is_open) {
- return _is_open;
- }
- }
-
- private set {
- lock (_is_open) {
- _is_open = value;
- }
- }
- }
-
- /** {@inheritDoc} */
- public override Logging.Source? logging_parent { get { return _logging_parent; } }
- private weak Logging.Source? _logging_parent = null;
+ internal string path { get; private set; }
private DatabaseConnection? primary = null;
- private int outstanding_async_jobs = 0;
private ThreadPool<TransactionAsyncJob>? thread_pool = null;
/**
@@ -382,12 +372,6 @@ public class Geary.Db.Database : Context {
);
}
- // async transactions are executed in the thread pool, so lock
- // to ensure consistency if multiple added simultaneously
- lock (this.outstanding_async_jobs) {
- this.outstanding_async_jobs++;
- }
-
this.thread_pool.add(new_job);
}
@@ -428,11 +412,6 @@ public class Geary.Db.Database : Context {
} else {
job.failed(open_err);
}
-
- lock (outstanding_async_jobs) {
- assert(outstanding_async_jobs > 0);
- --outstanding_async_jobs;
- }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]