RE: Threads in Eu 2.5?

new topic     » goto parent     » topic index » view thread      » older message » newer message

I know I can do that, but I was hopeing threads would be part of 
Euphoria 2.5. It should run faster and be easyer to use. Priorities 
could be very useful in more advanced programsy.

Kat wrote:
> 
> 
> On 25 Jan 2004, at 15:14, CoJaBo wrote:
> 
> > 
> > I think threads are needed in Euphoria. The example below would be 
> > fairly easy to use. Many programs would benifit from this.
> > procedure new_thread(integer routine_id,sequence params,int priority)
> > new_thread() starts the thread and returns imediatly.
> > 
> > routine_id is the routine id for the procedure to run
> > 
> > params is "params must be a sequence of argument values of length n, 
> > where n is the number of arguments required by the procedure. If the 
> > procedure does not take any arguments then params should be {}."(copied 
> > from manual: call_proc)
> > 
> > priority is somthing like HIGH, LOW, NORMAL, ABOVENORMAL, ect
> > 
> > 
> > procedure a()
> > integer t
> > t=time()
> > for z=1 to 1000000+i do
> > --do something that takes a lot of time here
> > end for
> > ?time()-t  --a fairly high number
> > end procedure
> > 
> > procedure b(integer i)
> > integer t
> > t=time()
> > for z=1 to 1000000+i do
> > --do something that takes a lot of time here
> > end for
> > ?time()-t  --a fairly high number
> > end procedure
> > 
> > integer tt
> > tt=time()
> > new_thread(routine_id("a"),{},ABOVENORMAL)
> > new_thread(routine_id("b"),{rand(10)},LOW)
> > ?time()-tt  --would display a number near 0 because new_thread() returns 
> > 
> > imediatly
> 
> I think you can do this with the Al Getz Windows Server Without Equal in 
> the 
> user archives, just let your new thread know it is to send it's results 
> to the 
> server, let the server be your app's giu, and Al naturally knows more 
> about 
> this than i do. I wasn't joking or poking fun when i said he reinvented 
> win3.x. 
> Your threads would be independant processes, but you can still send them 
> 
> msgs in many ways on windows, there's several programs in the archives 
> you can use instead of the real threads msgs. Can't change or set 
> priorities 
> tho.
> 
> Kat
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu