From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Callbacks from modules Date: Fri, 27 Nov 2015 10:29:09 +0200 Message-ID: <837fl3u9pm.fsf@gnu.org> References: <83si3svk91.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1448613038 13294 80.91.229.3 (27 Nov 2015 08:30:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Nov 2015 08:30:38 +0000 (UTC) Cc: emacs-devel@gnu.org To: Ivan Andrus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 27 09:30:28 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 1a2EQE-0005KY-Da for ged-emacs-devel@m.gmane.org; Fri, 27 Nov 2015 09:30:26 +0100 Original-Received: from localhost ([::1]:55320 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2EQH-0006TK-2A for ged-emacs-devel@m.gmane.org; Fri, 27 Nov 2015 03:30:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2EQA-0006Sj-CM for emacs-devel@gnu.org; Fri, 27 Nov 2015 03:30:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2EQ5-0002cr-Bi for emacs-devel@gnu.org; Fri, 27 Nov 2015 03:30:22 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:52702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2EQ5-0002cJ-3M for emacs-devel@gnu.org; Fri, 27 Nov 2015 03:30:17 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NYG00E00SQ09U00@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Fri, 27 Nov 2015 10:29:23 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NYG00E6QSWY5M60@a-mtaout20.012.net.il>; Fri, 27 Nov 2015 10:29:23 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 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:195355 Archived-At: > 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. You could do that on the C level, no? You don't need anything from Lisp to start reading again. > > Another, perhaps simpler, possibility would be to have the module > > provide a Lisp-callable function that will register a Lisp callba= ck. > > Then your C callback will simply call that Lisp function. >=20 > I don=E2=80=99t understand how I would implement this option, thoug= h it sounds like what I was hoping for. In order to call a lisp func= tion, don=E2=80=99t I need an emacs_env? Forget it, it probably won't work anyway, because your C callback run= s in another thread, right? Module code cannot run in any thread but the main thread.