Subject: [SWIPL] noticed one thing: is it normal that different agents use the same streams under the same host?

From: starred <[email-masked]>
Date: Thu, 25 Oct 2001 13:40:13 +0200

I've noticed that different agents starting on the same host, use 
streams denoted by the same code, i don't know exactly how streams are 
used by Windows, in particular i don't know if a stream code is local to 
the thread that opened it (in this case it should not be a problem) or 
if it is globally recognized by Windows (in this case it would generate 
an error when two threads try to use the same stream..)

Another report about my problem: i had the same problem some times ago, 
the i changed the timer value (see prolog-code below) and it did function.
Now i made some changes in the coordinator (it is the agent that finds 
facilities for othr agents in the web) code, and now coordinator (and 
only it) gives me the trapped signal 11 (general protection fault) error...

starred wrote:

> This an error that very often occurs during execution of a communication 
> between some agents i've created
> 
>  Trapped signal 11 (general protection fault), aborting ...
>       [1] '$toplevel'
> % Abort: closed stream '$stream'(5158192)
> % Abort: closed stream '$stream'(5149938)
> % Abort: closed stream '$stream'(5148678)
> % Execution Aborted
> 
> The problem is that after compiling the files, SWI prolog gives me no 
> error or warning, and i cannot understand where the problem is.
> Notice that the error occurs very often, but not always...
> 
> I'm working on an agent based environment, so every agent is both a 
> server and a client.
> the serving job is done in this way:
> 
> 
> dispatch(_GUI) :-
>     new(@dispatch_timer,timer(0.3,message(@prolog,dispatch1))),
>     send(@dispatch_timer,start).
> 
> 
> dispatch1 :-
> 
> findall(ReadStream,agents:connection(_ClientId,_Host,ReadStream,_WriteStream),Clients), 
> 
>     listen_stream(Server),
>     wait_for_input([Server|Clients],ReadyList, 0.05),
>     (ReadyList \= [])
>     ->
>     format('ReadyList is: ~w~n',ReadyList),
>     process_listen_queue(ReadyList)
>     ;
> % write(waiting),nl,flush_output,
>     true.
> 
> 
> process_listen_queue([]).
> 
> 
> process_listen_queue([H|T]) :-
>     handle_incoming(H),
>     format('ok~n~n'),
>     process_listen_queue(T).
> 
> 
> Bye
> 
> Armando Stellato
> 
>