From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Panicz Maciej Godek Newsgroups: gmane.lisp.guile.user Subject: Re: Request for help Qt, C++ and guile REPL. Date: Thu, 20 Jun 2013 19:46:30 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b417e19b8e21204df99863e X-Trace: ger.gmane.org 1371751163 9324 80.91.229.3 (20 Jun 2013 17:59:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Jun 2013 17:59:23 +0000 (UTC) Cc: "guile-user@gnu.org" To: =?ISO-8859-1?Q?Eduardo_Acu=F1a?= Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Jun 20 19:59:24 2013 Return-path: Envelope-to: guile-user@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 1Upj8l-0005Di-DL for guile-user@m.gmane.org; Thu, 20 Jun 2013 19:59:23 +0200 Original-Received: from localhost ([::1]:36145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upiwf-0004mO-Bi for guile-user@m.gmane.org; Thu, 20 Jun 2013 13:46:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpiwK-0004ZZ-Mi for guile-user@gnu.org; Thu, 20 Jun 2013 13:46:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpiwI-0001xJ-RB for guile-user@gnu.org; Thu, 20 Jun 2013 13:46:32 -0400 Original-Received: from mail-vc0-f176.google.com ([209.85.220.176]:63917) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpiwI-0001x8-L5 for guile-user@gnu.org; Thu, 20 Jun 2013 13:46:30 -0400 Original-Received: by mail-vc0-f176.google.com with SMTP id ha12so4978021vcb.7 for ; Thu, 20 Jun 2013 10:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=hF4MMChcq3d3vNdrj24CpoI0dZNd68mum7ISEeVlpcA=; b=cMz5Ao2HwrGTpISmLBJ2ApGj7XkbVbp/2OIFRqKnVY/6Jq46+cPSByF6BTPbqnEdKk VGWYV7oyIHm7ay68GOMsl8NFU7SWy7GDx/LjQcSub1RjdqpfJIhtKUffB4mUiDN8cPHJ iAQ39BxxhPBEbpsZQcSthgndTCQu99/weg36SJ1dXSY0/lH4R01KKK+4VFavHzUMGADj ZwZqLyJQMMcsLPXo1sHiyjr3+AQxHl0p+DBMzZscJgGdiF9DCUqs1Dlyt16n7dQfcLDy Jr+99HEhj59kgdXSfrRVqnNJkNkUhfyH1Qvh1NBBSn6LcoaXduMbT2RYIvBxe7j6mOVS i6MA== X-Received: by 10.58.32.138 with SMTP id j10mr3726028vei.64.1371750390093; Thu, 20 Jun 2013 10:46:30 -0700 (PDT) Original-Received: by 10.220.249.4 with HTTP; Thu, 20 Jun 2013 10:46:30 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.176 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10484 Archived-At: --047d7b417e19b8e21204df99863e Content-Type: text/plain; charset=ISO-8859-1 Hi, one way would be to run the code in a separate thread. Perhaps it wouldn't be particularly elegant, but you could simply append "(call-with-new-thread (lambda()" "))" before calling eval. You'd need to reorganize your app, however, if you'd wish to display the expression's resulting object, because if you did it that way, you'd only get a thread object. A possible solution would be to do something like this: (define thread-results (make-hash-table)) (let ((thread (call-with-new-thread (lambda()(let ((result )) (hash-set! thread-results (current-thread) result)))))) (set-thread-cleanup! (lambda() ))) I probably wouldn't know however how to implement that at the C level. Best regards --047d7b417e19b8e21204df99863e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi,
one way would be to run the code in a separa= te thread.
Perhaps it wouldn't be particularly elegant,= but you could simply
append "(call-with-new-thread (l= ambda()" <code-from-your-text-field> "))" before calli= ng eval.
You'd need to reorganize your app, however, if you'd wis= h to display the expression's resulting object, because if you did it t= hat way, you'd only get a thread object.

A possible solution would be to do something like this:
(define thread-results (make-hash-table))

(let ((thread (call-with-new-thread=A0
=A0 =A0 = =A0 =A0 (lambda()(let ((result <code-from-your-text-field>))=A0
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (hash-set! threa= d-results (current-thread) result))))))
=A0 (set-thread-cle= anup! (lambda() <display data from thread results to the text field>)= ))

I probably wouldn't know however how to implement that= at the C level.
Best regards

--047d7b417e19b8e21204df99863e--