Sebastian Sardina wrote: > could there be any way to "throw" an event from one eclipse "thread"/execution > to another? > I want to avoid interrupts in order to be portable to windows. I imagine to > have to eclipse programs A and B where A may want to "signal" B at some point > (but not using interrupts). I can do this if A is a C++ program that > initiates B and then A can post an event to B using "post_event()" as the > documentation says. However, I do not want to use any C++ in my application, > everything should be ECLIPSE! ;-) I am willing to start B inside A using > exec/3 or anything similar. The simplest approach is to have a client/server structure where A is the client and B is the server. B waits in a blocking read (on a pipe or socket) until A writes a request, and then A waits for the result and B writes it back when finished. Example: % start process B from A % B executes a repeat-read-process-write server loop % (here simply evaluating an arithmetic expression) [eclipse 19]: argv(0,Cmd), exec([Cmd,"-e","repeat,read(X),Y is X,printf('%w.%n%b',[Y]),fail"], [in,out], P). Exec = "M:\\Eclipse\\5.7\\lib\\i386_nt\\eclipse.exe" P = 176 Yes (0.00s cpu) % now write a request and read the result back: [eclipse 20]: printf(in, '%w.%n%b',[3+4+5]), read(out,Res). Res = 12 Yes (0.00s cpu) [eclipse 21]: printf(in, '%w.%n%b',[3*12]), read(out,Res). Res = 36 Yes (0.00s cpu) If you don't like the blocking reads, you can use select/3 to poll the streams (but note that on Windows this works only on sockets, not on pipes). In general, polling is easier to get working than designs with interrupts. -- Joachim Schimpf / phone: +44 20 7594 8187 IC-Parc / mailto:J.Schimpf@imperial.ac.uk Imperial College London / http://www.icparc.ic.ac.uk/eclipseReceived on Thu Aug 05 16:40:55 2004
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:29 PM GMT GMT