guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Request for help Qt, C++ and guile REPL.


From: Panicz Maciej Godek
Subject: Re: Request for help Qt, C++ and guile REPL.
Date: Thu, 20 Jun 2013 19:46:30 +0200

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()" <code-from-your-text-field> "))" 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 <code-from-your-text-field>)) 
                        (hash-set! thread-results (current-thread) result))))))
  (set-thread-cleanup! (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]