Re: [eclipse-clp-users] Events

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Wed, 01 Feb 2012 03:18:57 +0100
Bogdan Tanasa wrote:
> Hi,
> 
> I am interested if there is a way to signal events to a C application 
> when a goal posted in eclipse has finished.
> 
> For example inside bb_min a search method is called. Every time when the 
> search produces a valid solution I would to notify the C application and 
> do some processing.

You can do that by invoking the yield/2 predicate on the eclipse side.
This causes the control flow to return to the resume() function in your
C code.  You can then do something in C, then call resume() again, which
transfers control back to the yield/2 predicate.

Alternatively, you can use Eclipse queue-streams with the yield-property
to transfer control automatically, e.g. whenever the stream is flushed
(this method also works in the high-level interfaces for Tcl and Java).

I have uploaded some example code at
http://eclipseclp.org/wiki/Examples/YieldAndResumeInC


-- Joachim
Received on Wed Feb 01 2012 - 02:19:13 CET

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST