From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 8703B431FDA for ; Thu, 19 Jul 2012 11:43:30 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mpDBYcKwWOHV for ; Thu, 19 Jul 2012 11:43:26 -0700 (PDT) Received: from mail.bustany.org (bustany.org [176.31.244.208]) by olra.theworths.org (Postfix) with ESMTP id B2E79431FAE for ; Thu, 19 Jul 2012 11:43:26 -0700 (PDT) Received: from localhost.localdomain (91-158-2-79.elisa-laajakaista.fi [91.158.2.79]) by mail.bustany.org (Postfix) with ESMTPSA id 964C7140090 for ; Thu, 19 Jul 2012 20:45:55 +0200 (CEST) From: Adrien Bustany To: notmuch@notmuchmail.org Subject: [PATCH 0/2] Add flush/reopen methods to notmuch_database_t Date: Thu, 19 Jul 2012 21:43:19 +0300 Message-Id: <1342723401-26103-1-git-send-email-adrien@bustany.org> X-Mailer: git-send-email 1.7.7.6 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 18:43:30 -0000 Xapian (and therefore Notmuch? I would not mind a confirmation here) is thread safe as long as you don't share DB instances across threads. The database backend supports one writer and several concurrent readers. One possible model for multi threaded apps using Notmuch is to have one thread with a writable notmuch_database_t, and various with read-only notmuch_database_t instances. However, for the readers to see the changes done by the writer, the writer needs to flush the changes to disk, and the readers need to reopen the database. Those two patches add two methods to notmuch_database_t for this purpose (the signaling of the writer to the readers that they need to reopen is left to the application). Adrien Bustany (2): Add notmuch_database_flush method Add notmuch_database_reopen method lib/database.cc | 35 +++++++++++++++++++++++++++++++++++ lib/notmuch.h | 12 ++++++++++++ 2 files changed, 47 insertions(+), 0 deletions(-) -- 1.7.7.6