From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Andrus Newsgroups: gmane.emacs.devel Subject: Re: Callbacks from modules Date: Fri, 27 Nov 2015 10:30:41 -0700 Message-ID: <5C18B6F0-9C8B-4D19-A53F-28B0F4565615@gmail.com> References: <83si3svk91.fsf@gnu.org> <837fl3u9pm.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1448645480 12831 80.91.229.3 (27 Nov 2015 17:31:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Nov 2015 17:31:20 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 27 18:31:13 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a2MrY-00024N-4h for ged-emacs-devel@m.gmane.org; Fri, 27 Nov 2015 18:31:12 +0100 Original-Received: from localhost ([::1]:57870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2Mra-0007mj-US for ged-emacs-devel@m.gmane.org; Fri, 27 Nov 2015 12:31:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2MrB-0007m7-Vq for emacs-devel@gnu.org; Fri, 27 Nov 2015 12:30:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2MrA-00027S-SS for emacs-devel@gnu.org; Fri, 27 Nov 2015 12:30:49 -0500 Original-Received: from mail-oi0-x236.google.com ([2607:f8b0:4003:c06::236]:34598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2Mr6-000261-0N; Fri, 27 Nov 2015 12:30:44 -0500 Original-Received: by oies6 with SMTP id s6so65677929oie.1; Fri, 27 Nov 2015 09:30:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=gr1yDPdFDw/RJuRjqE4gWqNXDawDIBTkxpF5QIvMX/M=; b=LK/5fGdAfBV/DyUVsiI9cV/AEQqSJTcreOKES9qaDg17YgbP/nN907qhfyNDt07GnI TrFlMSmY3Gql9kjqs/+VrvsMgLAJBt48wYhGD7eiNbXjlHI75WqXnr+pZbFIcXTXkys7 b9iV9kkHyI0fp2b37EZgtn5jjvPQb4KTFLtvYhRR8JZ7BtQWOGBJDC9tLl43RyUVrIRA kfeTsjdyVE6lAE2+XhZ2IaCHx7VOLn8+nmpgKnnkUCJQPglhmka+ZNlcOFLAnuBM3KZY swv4P7627GHa8YNwlMn0v15UQhZjrcFo3ccw+HkSo8Mt4ADxNfLgjpsDizhtxtLOm/MO CfiQ== X-Received: by 10.202.92.138 with SMTP id q132mr19928484oib.45.1448645443306; Fri, 27 Nov 2015 09:30:43 -0800 (PST) Original-Received: from [192.168.0.3] (97-117-43-47.slkc.qwest.net. [97.117.43.47]) by smtp.gmail.com with ESMTPSA id w84sm15825986oie.26.2015.11.27.09.30.42 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Nov 2015 09:30:42 -0800 (PST) In-Reply-To: <837fl3u9pm.fsf@gnu.org> X-Mailer: Apple Mail (2.3096.5) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:195392 Archived-At: On Nov 27, 2015, at 1:29 AM, Eli Zaretskii wrote: >=20 >> From: Ivan Andrus >> Date: Thu, 26 Nov 2015 20:23:48 -0700 >> Cc: emacs-devel@gnu.org >>=20 >>> Then one way would be to have that callback set a flag, >>> provide a Lisp-callable function that returns the flag, and then = start >>> a timer that will test the flag and call your Lisp callback when the >>> flag is set. >>=20 >> I was hoping to avoid polling, since the use case I have would like = to start reading again as soon as the previous version finishes. >=20 > You could do that on the C level, no? You don't need anything from > Lisp to start reading again. I should have said I want the option of continuing to read. I wanted = that logic (along with what to read next) in lisp. >>> Another, perhaps simpler, possibility would be to have the module >>> provide a Lisp-callable function that will register a Lisp callback. >>> Then your C callback will simply call that Lisp function. >>=20 >> I don=E2=80=99t understand how I would implement this option, though = it sounds like what I was hoping for. In order to call a lisp function, = don=E2=80=99t I need an emacs_env? >=20 > Forget it, it probably won't work anyway, because your C callback runs > in another thread, right? Module code cannot run in any thread but > the main thread. Okay, I was wondering about that. Based on the back trace it did look = like it was running in the same thread, but it=E2=80=99s probably best = to not rely on that. Thanks, Ivan=