Re: throwing an event into eclipse

From: Sebastian Sardina <ssardina_at_cs.toronto.edu>
Date: Thu 05 Aug 2004 04:13:23 PM GMT
Message-Id: <200408051213.23685.ssardina@cs.toronto.edu>
Thanks Joachim for your reply. I think I understand your point and the idea of 
the client-server design. 
In principle my program B is not a "server" per se, but assuming that I can 
turn it into a server, my concern now is how can I make B "span" itself so 
that it can handle multiple "unlimited" requests. 

For instance, I checked the implementation of http_server and, for what I 
understand reading the code, it would handle only 1 request at a time and the 
client must wait until the request is finished. 

One way I can imagine is to handle each request with an external call using 
exec/3, but in that case I cannot work at all on the current instance of my 
server, I would like to handle the request *inside* the server and span the 
server so that it keeps listening for requests.

Now, I imagine that what I am asking is something like multi-threading 
capabilities that I think eclipse do not have (yet). Am I correct?

Thanks

Sebastian




On Thursday 05 August 2004 11:38 am, Joachim Schimpf wrote:
> 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.
Received on Thu Aug 05 17:15:29 2004

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:29 PM GMT GMT