comp.lang.ada
 help / color / mirror / Atom feed
From: Jean-Pierre Rosen <rosen@adalog.fr>
Subject: Re: curses and multithreading
Date: Wed, 05 Aug 2009 10:17:34 +0200
Date: 2009-08-05T10:17:34+02:00	[thread overview]
Message-ID: <57fb5h.i45.ln@hunter.axlog.fr> (raw)
In-Reply-To: <h5a6i9$sg$1@news.newsland.it>

Lisa Ansellotti a �crit :
[...]
> the problem is this: i need that the secondary thread use the window to
> ouput data, and the main thread continuosly get input, elaborate the input
> and give the output on its windows (not in the second thread's window).
>  
> but if i try to do this, the secondary thread stops the input.
> in the main thread i do a "get" for input a string, when the secondary
> thread do an output on ITS window, the input in the input window is
> blocked.
> 
> how can i do to make the two threads independently use input/output,
> without one block the other thread's i/o?
> 
> 
> this is a part of the source.
> 
> 
> task DbCheck is
> 	entry StartRun;
> end DbCheck;
> 
> 	
> task body DbCheck is
> 	begin	
> 	accept StartRun do
> 		While ContinueRunning=true loop
> 			delay 20.0;
> 			WriteDbMessages;
> 		end loop;
> 	end Ciclo;
> end DbCheck;

Here, your loop is *inside* the rendezvous. It means that the caller
(main) will not proceed until the loop is over. You probably meant:
 task body DbCheck is
 	begin	

 	accept StartRun;
        -- Main returns here

	While ContinueRunning=true loop
           delay 20.0;
 	   WriteDbMessages;
 	end loop;
> end DbCheck;

Note that:
1) your code has this problem, but it is not exactly what you describe
2) your code has a syntax error ("end Ciclo" instead of "end StartRun").

Please always provide the *exact code* that shows the problem, to allow
us to be maximally helpful.
-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



  reply	other threads:[~2009-08-05  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-04 20:43 curses and multithreading Lisa Ansellotti
2009-08-05  8:17 ` Jean-Pierre Rosen [this message]
2009-08-05 17:20   ` Lisa Ansellotti
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox