Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1B939431FAF for ; Mon, 23 Apr 2012 13:43:07 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 pVV4mfUsWxX5 for ; Mon, 23 Apr 2012 13:43:06 -0700 (PDT) Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id CD5E3431FAE for ; Mon, 23 Apr 2012 13:43:05 -0700 (PDT) Received: by bkcjm2 with SMTP id jm2so2465624bkc.26 for ; Mon, 23 Apr 2012 13:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=TKowrrC6ONX0UtotMe9lRoO+LGE8mGy1L5JaM51UUXs=; b=ZkOxioEU3cAAMOZZnEepdyWJHay0fYesbj+2rlMpkoTjcy014fI+biOooPrSQPg+3z 6mqoJQI9//EuMoOXs2YvxpWLnzRrEnL3bTesTttcqEeoR0vQ/N8SlcS404L6sHz+8Plu NCxc6s2s6QCUmU6zqL4goX+Q2Tq4K7d5emsvZhqWJfOQJ/7KQLsF8sue7IA2oqQ0uJ+3 5zquJKeouope2sMld/F4iA2bt1/nUwhd1+TEnks1OW+997mqlpyuyvXIzzNEVN7bRbw4 tnLhnWrONnAcDGNkADux6cBu+ldp1nyNlvJbJ2tlfrfv4KIz7oG61FfXK5HQI6Y/oYeC VFNw== MIME-Version: 1.0 Received: by 10.204.152.209 with SMTP id h17mr2884104bkw.111.1335213784219; Mon, 23 Apr 2012 13:43:04 -0700 (PDT) Sender: polatel@gmail.com Received: by 10.204.123.73 with HTTP; Mon, 23 Apr 2012 13:43:04 -0700 (PDT) In-Reply-To: References: <1335185032-13075-1-git-send-email-felipe.contreras@gmail.com> Date: Mon, 23 Apr 2012 23:43:04 +0300 X-Google-Sender-Auth: G2yLOadNJ0F1xHWZwlD2SFYppnU Message-ID: Subject: Re: [PATCH] ruby: make sure the database is closed From: Ali Polatel To: Felipe Contreras Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: notmuch@notmuchmail.org 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: Mon, 23 Apr 2012 20:43:07 -0000 2012/4/23 Felipe Contreras : > On Mon, Apr 23, 2012 at 5:04 PM, Ali Polatel wrote: > >> I'd rather not do this. >> Please read: http://comments.gmane.org/gmane.comp.lang.ruby.general/3203= 24 > > OK, I've read this.. So? You are one step close to what I thought you had thought. > The order in which Ruby's garbage-collector frees the database and > other objects is irrelevant, because with this patch we are not > manually freeing other objects, only the database. What I wanted was to make all objects "depending" on the database to be unu= sable once the database object is freed. Seeing that's not practically easy I decided to leave it to the user. > Sure, it's _better_ if the user calls close(), even better if it's > inside an 'ensure', and even better if blocks are used (which I am > using in most cases), but that's not *required*. If you have such a use case, I'm fine with that patch. I might push it in the next few days or get someone else to push it. > The user might just do: > > def foo > =A0db =3D Notmuch::Database.new($db_name, :mode =3D> Notmuch::MODE_READ_W= RITE) > end > > That's perfectly fine in Ruby (although not ideal), since 'db' will > get garbage-collected. But nobody will be able to use the database > again until that process is killed. > > You think that's correct? Yes that is correct. I have not thought about this. I'd say it's a partial misunderstanding on my part due to lack of (and/or too much) vodka. > -- > Felipe Contreras -alip